Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

How to set Lookup field on newly created record from Resco

$
0
0

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. 


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>