Error "Cannot read property length from undefined" in my custom workflow activity 'Create PDL'., whenever catalog item goes through the workflow.

Abhijit Das2
Kilo Explorer

I am receiving an error "Cannot read property length from undefined" in my custom workflow activity 'Create PDL'. I have simply created a custom activity under the exchange application,name 'Create PDL'.This activity is used in a catalog item workflow to create shared mailbox in the exchange server automatically.

Can you guys help me , how to eliminate this error and make the workflow run smoothly, at the same time create a shared mailbox in the exchange server. 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Abhijit,

so it means you are trying to get length from string or an array but that array or string is empty.

can you check on what length is applied?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Abhijit,

so it means you are trying to get length from string or an array but that array or string is empty.

can you check on what length is applied?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello Ankur , 

I have taken some input parameters in the custom activity inputs. And the following pre-processing script is running ,where length is applied. This script is OOB- 

if (activityInput.parameters !== null && activityInput.parameters.length > 0) {
var paramsObj = new sn_exchange.ExchangeUtil().createPSObject(activityInput.parameters);

if (paramsObj) {
// Added it to the powershell variables
executionParam.powershellVariables.push(paramsObj);
}
}

 

All the activity input values are provided accordingly , yet the workflow is throwing the error. 

Ankur - Do you have any known workaround?

Hi Abhijit,

so activityInput.parameters has length on it?

can you print that?

whether any input parameter you are sending to that activity; it 

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks Ankur. Length was set on the parameter field, which was not defined in the Input Parameter, hence that error was thrown. 

Now my activity is not throwing that error any more. I have added an info message to log the error message. I am using this activity in a catalog workflow to create shared mailbox for an user. But I am getting the below error.

 Cannot bind parameter 'DisplayName' to the target. Exception setting "DisplayName": "The property can't be empty."

displayName is one of the Input parameter in the activity. 

 

Can anybody tell me why am I getting this error and how to eliminate this error.