UI macros in front of caller field

kaushiki berter
Tera Expert

Hi, I was learning about UI macros and my requirement is to add Assign me icon in front of caller field so that whenever user clicks on that icon, he can assign himself as caller. I have created following UI macro and added it to the dictionary level on caller field.

After adding this I was not able to see that macro on caller field in new form. Kindly help me with the functionality.

kaushikiberter_0-1722233372995.pngkaushikiberter_1-1722233497505.png

 

 

1 ACCEPTED SOLUTION

kaushiki berter
Tera Expert

I have found the solution. Above scripts were missing the main functionality. The exact solution should be that whenever the UI macro is clicked it should call a function which should contain the parameter as the field name. With the below code I was able to perform the functionality. 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<span id="add_me_button" class="btn btn-default icon-user-add" tabindex="0" title="Add me" onclick="addMe('caller_id')">
  <span class="sr-only">Add me</span>
</span>
<script>
  function addMe(reference) {
    var userID = g_user.userID;
    g_form.setValue(reference, userID);
  }
</script>
</j:jelly>

View solution in original post

6 REPLIES 6

Sumanth16
Kilo Patron

kaushiki berter
Tera Expert

I have found the solution. Above scripts were missing the main functionality. The exact solution should be that whenever the UI macro is clicked it should call a function which should contain the parameter as the field name. With the below code I was able to perform the functionality. 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<span id="add_me_button" class="btn btn-default icon-user-add" tabindex="0" title="Add me" onclick="addMe('caller_id')">
  <span class="sr-only">Add me</span>
</span>
<script>
  function addMe(reference) {
    var userID = g_user.userID;
    g_form.setValue(reference, userID);
  }
</script>
</j:jelly>