Scoped App ... does not support "setNewGuid" ???

Zod
Giga Guru

Hi Experts,

I'm currently shifting some develeopements (that worked) into a scoped app ... now I fave the issue, that I get en error message, telling me: "Error Message - Function setNewGuid is not allowed in scope xxx".

 

It's an UI action that urgently requires to generate a new sys_id within the underlying script ... but why does this not work within a scoped app?? What else could be used instead?

The UI action will create an record (that is in global) scope ... not sure if this is the issue?

Code like ... var record_id = newRec.setNewGuid();

Thank you!!!

1 ACCEPTED SOLUTION

yes this randomly creates a sys_id that I then could set ... ok. Would mostpropbably work as workaround. I do update within the catalog task activity, then the sys_id can also be retrieved. 

But thanks anyhow!

View solution in original post

9 REPLIES 9

The question was how to use setNewGuid() or something similar in scoped app ... not how to set a specific guid in scoped app ... 

Hi Ankur, sorry for not replying some years ago ..  I can remember that I chose to use an other approach and forgot about this post. Now again having the same issue and workaround not working properly. Need to get the ID within a SCOPED workflow activity (SC TASK) .... . setNewGuidValue(String guid) will not work as I need a generic solution getting the sc_task sys_id .. makes no sense to set the sys_id myself. setNewGuid()  works fine when global .. but there need to be a solution to do the same within scoped application. Any idea? Thank you! 

Hi, you can use this function in a scoped application:

var newSysId = gs.generateGUID();

 

For example such a UI Action

PaulKunze_1-1727689558151.png

would lead to this result:

PaulKunze_0-1727689430492.png

 

yes this randomly creates a sys_id that I then could set ... ok. Would mostpropbably work as workaround. I do update within the catalog task activity, then the sys_id can also be retrieved. 

But thanks anyhow!

Paul Kunze
Tera Guru

Hi, in a Scoped App you can make use of the return value of the insert() method.

So you can replace

var newSysId = current.setNewGuid();
current.insert();

with

var newSysId = current.insert();

to get the same result.