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

Hi Abhijit,

you are trying to set the displayName in AD; but that value seems to be empty so hence rejected by powershell

try printing this value and check if it is empty or not

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

sagarAgarwal
Kilo Contributor

Hi,

 

As mentioned by Ankur, "Cannot read property length from undefined"  error occurs when a variable is defined but it does not have any value and you call in a method/property like "length" on it.

 

An easy fix would be check for variable on which you are using length and debug why it does not have any value on it.

 

Thanks