Function setDisplayValue is not allowed in scope XYZ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2022 06:48 AM
HI Everyone,
I am trying to use setDisplayValue within workflow run script activity.
When I do so, I get the following error.
Error: Function setDisplayValue is not allowed in scope xyz__.
Is there any way to deal with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:01 AM
Hi Aman
If I am trying with this -> alm.transfer_order.setDisplayValue(parentID); // obj.field_name.setDisplayValue(value)
Showing this Error Message
Error Message ->Severe inconsistency between asset and transfer order line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:04 AM
Hi Aman,
If I am trying with this ->
alm.transfer_order.setDisplayValue(parentID); // obj.field_name.setDisplayValue(value);
Showing this Error Message :
Error Message ->Severe inconsistency between asset and transfer order line

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 02:07 AM
As I said earlier, you can just use setValue
Just changes these as below:
var too = current.variables.to_stockroom;
var fl = current.variables.from_stockroom;
var toloc = current.variables.to_stockroom.location;
var frloc = current.variables.from_stockroom.location;
var frStockName = current.variables.from_stockroom;
Now, use setValue
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2022 04:05 PM
Hi,
Please avoid posting duplicate questions. I've answered it in the other post.
The cause it that there's no .setDisplayValue() in scoped application. It's only supported in Global.
Check the documentation to confirm.
It's necessary to use setValue() or use dot notation in scoped application.
e.g.
var to = new GlideRecord('alm_transfer_order');
to.initialize();
to.from_stockroom = fl.toString();
to.to_stockroom = too.toString();
to.from_location.name = frloc.toString();
to.location.name = toloc.toString();
alm.request_line = current.getUniqueValue();
alm.transfer_order = parentID;
alm.model = aset.model;
alm.asset = aset;
alm.Value.quantity_requested = 1;