Hi, users are getting an error when creating a new 'Portal Comment' (ADX entity) in D365. I need help troubleshooting/resolving this. ANy feedback is welcome and appreciated - thanks!
The error is a script error OnLoad:
Here is Error Log:
TypeError: Cannot read property 'web' of undefined
at initialize (soprissystems.crm.dynamics.com/.../adx_portalcomment_form.js:3:98)
at mp.executeFunction (soprissystems.crm.dynamics.com/.../app.js
at mp.execute (soprissystems.crm.dynamics.com/.../app.js
at up._executeIndividualEvent (soprissystems.crm.dynamics.com/.../app.js
at up._executeEventHandler (soprissystems.crm.dynamics.com/.../app.js
at Object.execute (soprissystems.crm.dynamics.com/.../app.js
at O._executeSyncAction (soprissystems.crm.dynamics.com/.../app.js
at O._executeSync (soprissystems.crm.dynamics.com/.../app.js
at O.executeAction (soprissystems.crm.dynamics.com/.../app.js
at t.dispatch (soprissystems.crm.dynamics.com/.../app.js
Here are Form Properties:
Here is the web resource code it points to:
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 }] );
}
}
}