The CreatorCon Call for Content is officially open! Get started here.

UI action throwing error

AndersBGS
Tera Patron
Tera Patron

Hi all,

 

I might have the most stupid question, which I hope you can explain the reason. I'm trying to create a Client callable UI action with both client side and server side code in it.  The setup is like this:

AndersBGS_0-1760621152002.png

Where the code written is (currently just some test code):

function onCLickConvertGsr() {
    var answer = confirm("Are you sure?");
    if (answer) {
        gsftSubmit(null, g_form.getFormElement(), 'ConvertGsr');
    }
}

if (typeof window == 'undefined') {
    ConvertGsr();
}

function ConvertGsr() {
    var incGr = current;
	incGr.state = 8;
}

When trying to save this i get this error:

AndersBGS_1-1760621223907.png

Can one of you explain the reason for this? 

@Ankur Bawiskar - do you might have a good idea here?

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@AndersBGS 

did you try creating fresh UI action?

Also you can directly assign the value using current and you forgot to update

Ensure no before update BR stops the form submission

function ConvertGsr() {
	current.state = 8; 
        current.update();
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,

 

thanks for the comment. Other than the minor corrections to the server side, have you then seen such an issue before or having any knowledge around why such an issue could occur?

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

@AndersBGS 

Nope, haven't seen this issue.

Could be an intermittent connection or instance issue.

Anyhow it's PDI and PDIs are highly unstable and no guarantee on their behavior.

Try clearing instance cache using cache.do

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader