Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Calling Decision Table from script

KeerthiPraV
Tera Contributor

I have a use case I have created a decision table for auto populating category based on product. if i select any product the category should auto populate based on the product without saving the form itself 
So, I want to Use on change(product) client script. So, When I am changing the product based on product category should populate for that i have created decision table for which product which category should come.
but, problem is with I am using script include to call the decision table using DecisionTableAPI()...But its returning null.

could you clarify me...How I need to call and what is the best approach to implement my use case.

4 REPLIES 4

prerna_sh
Tera Sage
Tera Sage

Hi @KeerthiPraV 
Check out these articles:
https://www.servicenow.com/community/developer-blog/how-to-use-decision-table-from-scripts/ba-p/2641...
https://www.servicenow.com/community/developer-blog/servicenow-learning-173-how-to-call-decision-tab...
https://www.servicenow.com/community/workflow-automation-forum/querying-a-decision-table-from-a-cata...

-------------------------------------------------------------------------------------------------------------------------------------------
If my response solves your query, please marked helpful by selecting accept as Solution and Helpful. Let me know if anything else is required.
Thanks,
Prerna

Ankur Bawiskar
Tera Patron
Tera Patron

@KeerthiPraV 

so share your script include and client script?

is your script include client callable?

is your script include function getting called?

💡 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

Sarthak Kashyap
Mega Sage

Hi @KeerthiPraV ,

 

If you getting null when calling script include from client script make sure you are returning the values properly for example - create an array, push the values in an array in form of string using .toString() function or adding +"". 

 

When you getting the return response in your client script make sure to parse that array in callback function of your glideAjax.

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

PrashantLearnIT
Tera Sage

Hi @KeerthiPraV 

 

You can go through the following community posts/articles:

 

https://www.servicenow.com/community/servicenow-ai-platform-blog/making-smarter-decisions-in-service...

 

https://www.servicenow.com/community/workflow-automation-forum/querying-a-decision-table-from-a-cata...

 

https://www.servicenow.com/community/developer-blog/how-to-use-decision-table-from-scripts/ba-p/2641...

 

https://www.servicenow.com/community/developer-blog/servicenow-learning-173-how-to-call-decision-tab...

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************