Best way to request a catalog item for someone else in portal?

Chris Sanford1
Kilo Guru

We have a requirement that users are able to request a catalog item on someone else's behalf. The particular challenges we have are that it has to work on service portal, and we are using domain separation so the domain of the REQ, RITMs, and TASKs all need to be set based on the domain of who the item was requested for.

I have seen the following thread:

https://community.servicenow.com/community?id=community_question&sys_id=84e34fa5dbd8dbc01dcaf3231f96...

However, their solutions do not meet my requirements, as they are not portal compatible to my knowledge. Any thoughts on the best way to do this?

1 ACCEPTED SOLUTION

Async is required, because there is a delay between request and requested item. So Async will give time for both to be created. You can add the conditions back, if you have right condition. So the condition in your previous screenshot looks good to me.

This will not impact the upgrade. Because it is a custom script and I don't think you are doing anything wrong, as long as you are not adding a wrong company and wrong assignments who are not part of that domain.


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

11 REPLIES 11

Remove the condition for now, just for testing. And If you are able to put in the script instead of Set Value, so that it will be easy to debug.

 

And while using in script, since it is async, do use current.update();


Please mark this response as correct or helpful if it assisted you with your question.

I did no condition and current.company = current.request.company in my script. Still didn't work. One thing I forgot to mention is that this business rule as well as the previous screenshot seems to blank out company and make domain default. So it's doing something, just not what we want.

Update, it actually did work. I forgot the current.update() my bad. Now any idea why all this extra stuff was necessary, like blanking out the condition, and using an async script with current.update()? My fear is this doesn't exactly seem like best practice, and could be an upgrade disaster waiting to happen.

Async is required, because there is a delay between request and requested item. So Async will give time for both to be created. You can add the conditions back, if you have right condition. So the condition in your previous screenshot looks good to me.

This will not impact the upgrade. Because it is a custom script and I don't think you are doing anything wrong, as long as you are not adding a wrong company and wrong assignments who are not part of that domain.


Please mark this response as correct or helpful if it assisted you with your question.

Ok, well your solution works, thanks! Conditions worked as well, guess it was just the script part I needed.

Also interesting that I noticed in my OOB instance that the domain is always default for every REQ. Someone before me had customized to set company and domain based on the "opened by" which I deleted. I guess they don't even domain separate catalog requests at all OOB!