CA Service Management

Expand all | Collapse all

How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

  • 1.  How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-16-2019 01:09 PM

    I am new to service catalog and doing some experimentation. I have copied the forms associated with report and issue. I have noticed that in the “Your Information” box the end user can modify the name emailID and phone number fields which are pulled from the MDB. This information is captured (as modified) in Service Catalog and shows in the open requests Requested Services details.

     

    What I would like to do, is capture that information and appended (Name, EmaiID, Phone number) to the description entered on the Issue Information box that is transferred to service desk manager when the request is submitted. So far, I have not found a way to do that probably because I don’t really understand which variables this is captured in.



  • 2.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Broadcom Employee
    Posted 01-17-2019 08:49 AM

    Good Afternoon Ted.

    Yes, you can use the 'onSubmit' on the form, to execute the script java code.
    And indeed concatenate the values of these three variables.

    As to 'It would need to be sent back to SDM as ca_sdm_attr_description'.
    That's something I don't know how to accomplish that.

    The 'Report an Issue' code behind the scene, is internal hardcoded javacode, taking care of creating the SDM Incident.
    And this code can not be changed per user's requirement.

    Another option then could be to execute 'webservices code' to change the SDM Incident, after it has been created.
    And trigger that code somehow from within Catalog, possibly through EventRuleAction(ERA).
    But then you have to know the SDM incident, related to the SC request, which is stored in the mdb.

    All in All, this/that would be a (very) complex code to be build......

    Kind regards, Louis.



  • 3.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Broadcom Employee
    Posted 01-24-2019 07:41 AM

    Good Afternoon Ted.

     

    And although I am not a form-script-code writer, this looks okay to me.

     

    Kind regards, Louis.



  • 4.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Broadcom Employee
    Posted 01-17-2019 03:01 AM

    Good Morning Ted.

    Please check the below (as a possible way) to get you further on this request.

    1. SC-login (spadmin)
    2. Catalog/Forms/Forms
    3. CA Catalog Content/Service Management Forms/Issue Details
    >Your Information
    >>Name=$(_.user.commonName)
    >>EmailID=$(_.user.email)
    >>Phone number=$(_.user.phone[0])

    4. What you can to next is to build a script on the form.
    And in that script, set the content for the 'Description' component based on these 3 variables.
    Java script function: ca_fdSetTextFieldValue(ca_fd.formId,'<_id>','....');

    Kind regards, Louis van Amelsfort.



  • 5.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-17-2019 12:20 PM

    I will give it a try.

    Thanks.



  • 6.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-24-2019 07:36 AM

    I assume I need to put the javascript into the "Script" for the form called from the form's onSubmit.

    ca_fd.js.updateDescription()

     

    I have a function based on the information above (simplified) and have tried to add it to the beginning of the script, however I get an error ( ...Syntax error: expected '}') The update is below. Somewhere there is a error in syntax.

     

    Here is the script:

    {
    updateDescription: function() {
     var phoneNumber = ca_fdGetTextFieldValue(ca_fd.formId,'phone');
     var emailID= ca_fdGetTextFieldValue(ca_fd.formId,'emailid');
     var actualDescription = ca_fdGetTextFieldValue(ca_fd.formId,"ca_sdm_attr_description");
     ca_setTextFieldValud(ca_fd.formId,"ca_sdm_attr_description", actualDescription + phoneNumber + emailID);
    return true; 
      }
    }

     

     

    Thanks,

    Ted



  • 7.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-24-2019 02:50 PM

    On my side your script saves correctly but you did a typo in ca_fdSetTextFieldValue.

     

    Do not forget that what you put in "Script" is a specifically formatted piece of code so the beginning character is { and the last one is }. Each function in between should be separated by a comma

     

    {
    updateDescription: function()

       {
           code

       },

    updateSomethingElse : function()

    {

       code too

    }
    }

     

    Here is what it should looks like. This does save correctly on my end.

     



  • 8.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-17-2019 11:03 AM

    Since the OOTB integration does transfer the "ca_sdm_attr_description" field value to SDM description, you only need to do as Louis suggested.

     

    One thing you are doing wrong is : $(_.user.***) are variable that refers to the logged in user. Not the values in the textbox that the user modified!

     

     

     

    The correct solution is :

    //Get the new phone number and add a "label"

    var phoneNumber = "\r New phone number : " + ca_fdGetTextFieldValue(ca_fd.formId,'txt_phone');

    //Get the new emailID and add a "label"

    var emailID= "\r New emailID :" + ca_fdGetTextFieldValue(ca_fd.formId,'txt_email');

    //Get the text entered by the user in ca_sdm_attr_description

    var actualDescription = ca_fdGetTextFieldValue(ca_fd.formId,"ca_sdm_attr_description");

    //Set the text in ca_sdm_attr_description as the actual value + the phone number + the emailID

    ca_setTextFieldValud(ca_fd.formId,"ca_sdm_attr_description", actualDescription + phoneNumber + emailID);

     

     

     

    Did not test it



  • 9.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-17-2019 08:35 AM

    Thanks Louis,

    Does this need to be added as a function call in the form script?

    I assume you need to concatenate the data to a var:  Name=$(_.user.commonName),EmailID=$(_.user.email)...  then use the function ca_fdSetTextFieldValue?

    It would need to be sent back to SDM as ca_sdm_attr_description

    Thanks for the help.

    Ted



  • 10.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-25-2019 11:32 AM

    When I fixed my last typo, it was functional. The ticket created in Service Desk shows the information. This allows the analyst to verify any changes the end user updated. THANK YOU!

    An issue I now have is that the OOTB version already has a function ca_fd.js.updateRequestName()

    From what I have read, there can only be one function call from the Form onSubmit. Any ideas? I tried doing it individually as an onChange in the fields, but the vars do not persist (as there are written). Is it possible to define vars that I can update based on the onChange status on a field?

     

    updateDescription: function(){
       var userLoc= "\r Update Base Location : " + ca_fdGetTextFieldValue(ca_fd.formId,'location');
       var userPhone= "\r Update Phone : " + ca_fdGetTextFieldValue(ca_fd.formId,'phone');
       var userEmail= "\r Update E-mail : " + ca_fdGetTextFieldValue(ca_fd.formId,'emailid');
       var actualDescription = ca_fdGetTextFieldValue(ca_fd.formId,"ca_sdm_attr_description");
       var userName= "\r Update Name : " + ca_fdGetTextFieldValue(ca_fd.formId,'userID');

    ca_fdSetTextFieldValue(ca_fd.formId,"ca_sdm_attr_description", actualDescription + userName + userPhone + userEmail + userLoc);
    return true;
    },



  • 11.  Re: How to pull input data from a Catalog form and transfer it to the description field in a SDM ticket

    Posted 01-28-2019 10:38 AM

    ca_fd.js.updateRequestName() is called as the onSubmit function?

     

    If yes then you can create an onSubmit function looking something like :

     

    onSubmit : function(){

    if(ca_fd.js.updateRequestName() && ca_fd.js.updateDescription()){

    return true}

    else

    {return false}

    }