Hi Everyone, can anyone help me with this I am unable to set the value.
any help would be great.
I am using this id
Tag with id Tcount cannot be directly accessed from the javascript webresource registered to on the form. First we need to get access to HTML webreource and then to it's HTML tag. Try to use the below script to set tag value of HTML webresource from javascript webresource.
WebResource_Sample is HTML webresource name which you can get from CRM form and suffix it with '_d'.
var Pquantity = parent.document.getElementById("WebResource_Sample_d").childNodes[0].childNodes[0].contentDocument.getElementById("Tcount");
Pquantity.innerHTML = totalcount;
yes I am using custom HTML through id am trying to display the result which I am getting through custom javascript as I have displayed above
Hi thanks for the reply
i am unable to set value to field could please help me to find my error
function ProductQuantity(context) {
debugger;
var formContext = context.getFormContext();
var tempProduct = formContext.getAttribute("msdyn_product").getValue();
if (tempProduct != null) {
var proid = tempProduct[0].id;
}
var FetchXML="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"+
"<entity name='msdyn_productinventory'>"+
"<attribute name='createdon' />"+
"<attribute name='msdyn_warehouse' />"+
"<attribute name='msdyn_unit' />"+
"<attribute name='msdyn_qtyonhand' />"+
"<attribute name='msdyn_product' />"+
"<attribute name='msdyn_reorderpoint' />"+
"<attribute name='msdyn_qtyonorder' />"+
"<attribute name='msdyn_qtyavailable' />"+
"<attribute name='msdyn_qtyallocated' />"+
"<attribute name='msdyn_productinventoryid' />"+
"<order attribute='msdyn_product' descending='true' />"+
"<filter type='and'>"+
"<condition attribute='msdyn_product' operator='eq' uiname='0423530172J' uitype='product' value='" + proid + "' />"+
"<condition attribute='msdyn_warehouse' operator='eq' uiname='NETS-Riff_mains' uitype='msdyn_warehouse' value='{25069A0A-F382-EB11-A812-000D3AAF0EA4}' />"+
"</filter>"+
"</entity>"+
"</fetch>";
FetchXML = "?fetchXml=" + encodeURIComponent(FetchXML);
debugger;
Xrm.WebApi.retrieveMultipleRecords("msdyn_productinventory", FetchXML).then(
function success(result) {
debugger;
if(result.entities.length>0){
var totalcount= result.entities[0].msdyn_qtyavailable;
//var Pquantity=window.parent.document.getElementById("Tcount").value;
//Pquantity.innerHTML=totalcount;
formContext .getAttribute("new_test").setValue(totalcount);
}
} );
}
Hi,
Can I check if you are trying to set the value of a tag in HTML web resource (embedded on the form) from a javascript web resource (registered on the form)?
Is that an entity's out of the box HTML or is it your custom HTML?
Can you not get that via formcontext or xrm.page? docs.microsoft.com/.../clientapi-form-context
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156