I am trying to pass entitycollection input(productlines) to customaction as below but in context i am not getting the field productid(lookup) in the inputparameter but i am able to see the other input like text(sequencenumber).
I have followed the below link: www.inogic.com/.../
Can you please validate my code and let me know incase any modification.
function Action_Opportunity(TargetID, SourceID, FormType) {
var parameters = {};
parameters.ipFormType = FormType;
parameters.ipOpportunityProducts = GetOpportunityProductByType(FormType);
parameters.ipTargetOpportunityId = TargetID;
}
function GetOpportunityProductByType(FormType) {
var ecOpportunityProducts = [];
if (FormType != "onload") {
var _tabledata = table.getData();
for (var i = 0; i < _tabledata.length; i++) {
var entOpportunityProducts = new Object();
entOpportunityProducts["sequencenumber"] = _tabledata[i].LineNumber;
// Try1
entOpportunityProducts["productid"] = _tabledata[i].ProductID != "" ? { "@odata.type": "Microsoft.Dynamics.CRM.product", "productid": _tabledata[i].ProductID, "@odata.Name": "product" } : null;
//Try2
var erProduct = {};
erProduct.opportunityproductid = _tabledata[i].ProductID;
erProduct["@odata.type"] = "Microsoft.Dynamics.CRM.product";
entOpportunityProducts["productid"] = erProduct;
ecOpportunityProducts.push(entOpportunityProducts);
}
}
return ecOpportunityProducts;
}


Report
All responses (
Answers (