web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to set Lookup field on newly created record from Resco

(1) ShareShare
ReportReport
Posted on by 7

Hello:

I am creating a new Invoice Product record from a Case form in Resco Mobile CRM, and my particular issue is setting the "Existing Product" / 'productid' lookup field to an existing Product record. 

Here are some of the ways I've tried to pass this object along to no avail.

1: Passing the 'productid' the same way I'm passing my 'invoiceid' data results in the invoice product being made but the 'productid' field not being populated by the specified record:

line_item.properties["invoiceid"] = {
 id: editedEntityProps.new_invoiceid.id,
 entityName: "invoice"
};

line_item.properties["productid"] = {

id: getProduct(),
name: product_name,
type: "products"
};

2 Passing the 'productid' explicity as it's own fields by using the following:

line_item.properties["_productid_id"] = getProduct();
line_item.properties["_productid_type"] = "products";

line_item.properties["productname"] = product_name;

3 Creating a reference to a product object, filling with data, and passing: (this one is weird because if the entity name is wrong it stops and throws an error, but if it's correct it doesn't correctly assign the lookup.)

line_item.properties["productid"] = new MobileCRM.Reference("products",getProduct(),product_name);

4 Tried just wrapping all of line_item.properties into one assignment block as so:

line_item.properties = {
invoicedetailname: product_name,
quantity: 1,
csm_toothnumber: getToothId(this.value),
csm_quadrant: getQuadrant(this.value),
invoiceid: { id: editedEntityProps.new_invoiceid.id, entityName: "invoice" },
productname: product_name,
isproductoverridden: false,
ispriceoverridden: false,
productid: { id: getProduct(), name: product_name, type: "products" }
};

As a note, I've tested all variables and functions to produce the correct output. Currently, I am able to create an invoice product with everything except for the 'productid' lookup field/relationship set even though I am able to successfully set 'invoiceid', another lookup field/relationship. 

*This post is locked for comments

I have the same question (0)
  • Thomas David Dayman Profile Picture
    11,323 on at

    The 'new MobileCRM.Reference' should work. Have you added some alerts to see what values are being passed into getProduct()? Also the entity name seems incorrect but im sure you have checked this already.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans