Hi everyone,
we are currently running into an error when trying to create a portal comment via the timeline.
TypeError: Cannot read property 'web' of undefined
You can still write the portal comment after pressing "OK" on the error message without any other issues.
Our current assumption is that it has something to do with Xrm.Page being outdated.
How can we either solve the problem or prevent the error from being shown?
Below is the code of the webressource in question. The workaround with the newer APIs doesn't work here since we can't get the formContext here.
Does anyone know if MS is going to fix this in the near future?
Thank you for your help and best regards.
function initialize()
{​
if ( Xrm.Page.ui.getFormType() == 1 && ( Xrm.Page.context.client.getClient() === Xrm.ClientName.web || Xrm.Page.context.client.getClient() === Xrm.ClientName.mobile ) ) {​
​
//Set the default value for direction code as Outgoing for Web Client.​
if ( Xrm.Page.getAttribute( "adx_portalcommentdirectioncode" ).getValue() != null ) {​
Xrm.Page.getAttribute( "adx_portalcommentdirectioncode" ).setValue( 2 );​
} ​
​
//Set From lookup field with the value based on current user.​
Xrm.Page.getAttribute( "from" ).setValue( [{ id: Xrm.Page.context.getUserId(), name: Xrm.Page.context.getUserName(), entityType: "systemuser" }] );​
​
//Set To Lookup field value based on the Query String parameters passed from Case form.​
var parameters = Xrm.Page.context.getQueryStringParameters();​
​
if ( parameters["partyid"] != null && parameters["partyname"] != null && parameters["partytype"] != null ) {​
var entityTypeName = null;​
if ( Xrm.Page.context.client.getClient() === Xrm.ClientName.web ) {​
var entityTypeCode = parseInt( parameters["partytype"], 10 );​
entityTypeName = Xrm.Internal.getEntityName( entityTypeCode )​
}​
else​
{ ​
entityTypeName = parameters["partytype"];​
} ​
Xrm.Page.getAttribute( "to" ).setValue( [{ id: parameters["partyid"], name: parameters["partyname"], entityType: entityTypeName }] );​
} ​
}​
}