Publish Views: 395
On this under weblog, you’ll come to know how one can use assign worth to single lookup area and polymorphic lookup area whereas passing information in Xrm.WebAPI request in Javascript for Dataverse Energy Apps
Single Entity Lookup
If you wish to assign worth of a lookup area which is related to a single entity then use under format.
“<SchemaName_of_LookupField>@odata.bind”:”/<setnameofentity>(<id_of_parent_record>)”
Instance : “sbi_BankAccount@odata.bind”: “/sbi_sbibankaccounts(“+currentBankAccountRecId+”)”
Schema Title can ebe copied from Answer => Desk -> Subject -> Property -> Schema Title

NOTE :
Entity Set title could be copied utilizing Superior Instrument from Energy Apps Answer Entity Part. Navigate to your resolution, choose the entity from resolution, click on Instrument and select Copy Set Title.

Polymorphic Entity Lookup
If you wish to assign polymorphic lookup area worth like Buyer datatype then it’s a must to append goal entity logical title with scena title of the column as given under.
“<SchemaName_of_LookupField>_<targetentitylogicalname>@odata.bind”:”/<setnameoftargetentity>(<id_of_parent_record>)”
Instance : “sbi_Customer_contact@odata.bind”: “/contacts(<contactid>)”
“sbi_Customer_account@odata.bind”: “/accounts(<contactid>)”
FINAL CODE with Each Case
Right here I’ve given a pattern code with each lookup sort. On this code Financial institution Account is a Single entity lookup however Buyer is a polymorphic lookup. For Energy Automate additionally if you assign it’s a must to assign in right approach.

perform createCreditCard(formContext)
{
var currentBankAccountRecId= formContext.information.entity.getId().exchange("{","").exchange("}","");
var buyer = formContext.getAttribute("sbi_customer").getValue();
var customerid = buyer[0].id.exchange("{","").exchange("}","");
var information =
{
"[email protected]": "/contacts("+customerid+")",
"sbi_cardtype":918820001,
"[email protected]": "/sbi_sbibankaccounts("+currentBankAccountRecId+")",
"sbi_maximumlimit": 150000
}
// create account document
Xrm.WebApi.createRecord("sbi_sbicard", information).then(
perform success(outcome) {
alert("Bank card is created with ID: " + outcome.id);
// carry out operations on document creation
},
perform (error) {
console.log(error.message);
// deal with error situations
}
);
}
In Energy Automate, it’s a must to assign corrctly as given under screenshot.

You may enroll now !We’re giving 30% low cost on our Internship Program
Don’t miss the prospect to take part within the upcoming Internship Program which can be completed utilizing Microsoft Dot Web Internet Improvement Full Stack Expertise. The brand new batch can be ranging from Could 20, 2024. We could have most skilled trainers so that you can efficiently full the internship with reside mission expertise.
Why to decide on Our Internship Program?
Trade-Related Tasks
Tailor-made Assignments: We provide initiatives that align together with your educational background and profession aspirations.
Actual-World Challenges: Sort out industry-specific issues and contribute to significant initiatives that make a distinction.
Skilled Mentorship
Steering from Consultants: Profit from one-on-one mentorship from seasoned professionals in your area.
Profession Improvement Workshops: Take part in workshops that concentrate on resume constructing, interview abilities, and profession planning.
Networking Alternatives
Join with Trade Leaders: Construct relationships with professionals and broaden your skilled community.
Peer Interplay: Collaborate with fellow interns and alternate concepts, fostering a supportive and collaborative surroundings.
Ability Enhancement
Arms-On Expertise: Acquire sensible abilities and study new applied sciences by project-based studying.
Delicate Expertise Improvement: Improve communication, teamwork, and problem-solving abilities important for profession success.
Free Demo Class Accessible
+ There are no comments
Add yours