- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 10:50 AM
I have a UI Action and an onLoad Catalog Client Script that auto-populates a variable from a record to the Catalog Item form.
This works perfect.
However, if I manually open the Catalog Item on the Portal, the variable is auto- populated with the previous variable from using the UI Action.
How can I prevent this?
When manually ordering the Catalog Item, the variable should be blank when opening the Catalog Item form.
Here is my code.
UI Action:
Catalog Client Script:
Help is Greatly appreciated!!
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 10:19 AM
In that case, the simplest solution may be to use your original UI Action and Catalog Client Script, but change the UI Type on the CCS to 'Desktop' so that it doesn't run in Service Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 11:09 AM - edited 10-15-2024 11:10 AM
You shouldn't need the Catalog Client Script if you don't want to populate the variable when initiating the item manually, since the UI Action has the sysparm to set the value when that is used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2024 09:04 PM
My UI Action code does not populate the variable in the Catalog Item.
When I click the UI Action- it takes me to the Catalog Item, in the same window, and the Description field is blank.
Could you help me script it to where it does populate the Catalog Item variable from just the UI Action?
Here is my code.
UI Action:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2024 05:32 AM
Sorry, I was confusing a solution we had in place. In the UI Action we are not using getSession or putClientData, just the URL. In the Catalog Client Script we are populating the variable from the URL - so when loading the Catalog Item directly, the sys_parm won't be there, but should still work from the UI Action
function onLoad() {
var url = top.location.href;
var sd = new URLSearchParams(url).get("sysparm_short_desc");
g_form.setValue('short_desc', sd);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 07:36 AM
Hi Brad,
I appreciate your help!! But this still isn't working. Now the Short Description from the record does not populate at all when I click the UI Action (it just redirects to the Catalog Item in the same window)
Here is my code for the UI Action: