Alternative way to access item metadata on form

0 Likes
over 5 years ago

There are many ways to get item metadata in SBM - api, webservices, appscripts etc. However if you need it to be accessible from your javascript placed on state/transition form, it requires more complicated solutions, like creating AppScript which will read some tables and outputs JSON object you can use.

Alternative way is not ideal but simple and safe. If you are familiar with SBM templates, you may notice they contain many dollar-tags, like $INCLUDE(), $IF(), $SHELL() etc. They are processed by server and replaced with appropriate content (with respect to context, connected user, privileges). 

Let's consider a case when you need transition id and name in your script placed on transition form. In this case you should modify formbody.htm template. Find first <script> tag inside <body>, and add new variable declaration right here:

var transitionName_forCustomScript = "$TRANSITIONNAME()"; //I would suggest to don't use common names like transitionName to avoid any conflicts

Now transitionName_forCustomScript variable is accessible from your script on load. 

There is a list with tags could be used:

$SOLUTIONID() - id of current solution

$TABLEID() - id of current table

$TABLENAME() - table tame

$PROJECTID() - project name

$TRANSITIONID() - id of transition executing right now

$TRANSITIONNAME() - transition name

$TRANSITIONINTERNALNAME() - transition internal name

$USERID() - id of user which runs transition

$USERLOGINID() - user loginid

$USERLOCALE() - user locale

$USERAVATAR() - path to user avatar

Comment List
Anonymous
Parents
  • It has been seen that there are many ways to get item metadata in SBM - api, webservices, appscripts etc or if you need it to be accessible from your javascript placed on state/transition form, it requires more complicated solutions, like creating AppScript which will read some tables and outputs JSON object you can use.
Comment
  • It has been seen that there are many ways to get item metadata in SBM - api, webservices, appscripts etc or if you need it to be accessible from your javascript placed on state/transition form, it requires more complicated solutions, like creating AppScript which will read some tables and outputs JSON object you can use.
Children
No Data
Related Discussions
Recommended