How to pass sysid of created case (record producer) to a widget through record producer script?

sheejajose
Mega Expert

Hello,

We have a record producer for onboarding new cases. In the redirect to option we need to have a custom page. In that custom page the requirement is to have 3 links newly created Case request link , HR services link(back to record producers) and homepage. I can able to have the HR services link and homepage link in that custom page but not sure how to include the created case request in that custom page is there any way to pass the sysid of created case record from record producer to that custom portal page.

 

Regards,

Sheeja 

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

When you redirect the user to the new page in the record producer script, you can include a parameter with the sys_id - as an example where my page is mywidgetpage and the param is case_id:

producer.portal_redirect = "sp?id=mywidgetpage&case_id=" + current.getUniqueValue();

Then, in your widget, you can read the parameter of case_id from the URL

 var caseID = $sp.getParameter('case_id');
//construction your link

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

3 REPLIES 3

Michael Jones -
Giga Sage

When you redirect the user to the new page in the record producer script, you can include a parameter with the sys_id - as an example where my page is mywidgetpage and the param is case_id:

producer.portal_redirect = "sp?id=mywidgetpage&case_id=" + current.getUniqueValue();

Then, in your widget, you can read the parameter of case_id from the URL

 var caseID = $sp.getParameter('case_id');
//construction your link

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Hi Michael Jones,

Thanks for your response. One more query ,

  • After clicking on submit, if there is any error, it should be shown on Custom portal page 

Is there any ways to get to pass the error messages to the custom widget?

 

You could wrap your Producer script in a try/catch and then add the error to the URL as a parameter, the same way you are adding the sys_id - since it would be a text string you'd need to URL encode it. In your widget you would need to check if the parameter is anything other than "none" and then display it

Producer

var eString = 'none';
try {
	
	//Your code here
	
} catch(e) {
	eString = encodeURI(e.message);
}

producer.portal_redirect = "sp?id=mywidgetpage&case_id=" + current.getUniqueValue() + '&error=' + eString;

Widget

var rpError = $sp.getParameter('error');
	if(rpError != 'none') {
	data.error = rpError;
	}

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!