How to get and use the value entered in SP widget option in client controller

Ro5
Tera Expert

hello.
I am adding a String type option called "URL" to the SP widget's option schema.
I want to use the value of the option added next in the client controller, but I don't know how to get it.
I would like to know how to use the value entered in the option in the client controller.
"Option Schema"
[{"name":"url","section":"Presentation","label":"URL","type":"String"}]

 

Regards,
Ro

1 ACCEPTED SOLUTION

jaheerhattiwale
Mega Sage
Mega Sage

@Ro5 

Update the option schema option schema as below: (s letter in String should be a small letter)

[{"name":"url","section":"Presentation","label":"URL","type":"string"}]

 

In the server side define as variable as below:

data.optionUrl = options.url;

 

In client side use the above defined variable:

console.log(c.data.optionUrl);

 

jaheerhattiwale_0-1669979522644.png

 

Output:

jaheerhattiwale_1-1669979730198.png

 

 

Please mark as correct answer if this solves your issue

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

View solution in original post

1 REPLY 1

jaheerhattiwale
Mega Sage
Mega Sage

@Ro5 

Update the option schema option schema as below: (s letter in String should be a small letter)

[{"name":"url","section":"Presentation","label":"URL","type":"string"}]

 

In the server side define as variable as below:

data.optionUrl = options.url;

 

In client side use the above defined variable:

console.log(c.data.optionUrl);

 

jaheerhattiwale_0-1669979522644.png

 

Output:

jaheerhattiwale_1-1669979730198.png

 

 

Please mark as correct answer if this solves your issue

 

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023