CA Service Management

Expand all | Collapse all

setting a value to lookup field

  • 1.  setting a value to lookup field

    Posted Oct 10, 2017 07:45 AM

    Dear all,

     

    I need some help for setting a value to a lookup field like assignee. But I need to do it without using "Defaults" feature of data constraints. Any idea?

     

    BR

    Utku



  • 2.  Re: setting a value to lookup field

    Posted Oct 10, 2017 08:05 AM

    Hi,

    there is 2 ways I use:

    Regards,

    cdtj



  • 3.  Re: setting a value to lookup field

    Posted Oct 10, 2017 09:48 AM

    Hi cdtj,

     

    PRESET not works for my current scenario. I'll give a try to second option.

     

    Thanks.

    Utku



  • 4.  Re: setting a value to lookup field

    Broadcom Employee
    Posted Oct 10, 2017 11:10 AM

    Utku, you mean set a default value to the lookup field if it is empty? or have some additional condition attached to the

    lookup? I am thinking you could modify the schema on ON_NEW or use extraurl="ADDITIONAL_WHERE..." . My 2cents. Thanks _Chi



  • 5.  Re: setting a value to lookup field

    Posted Oct 10, 2017 04:26 PM

    Hi Utku,

    What do you want to base the pre-populated field on?  Meaning, for your example of populating the assignee field, what determines the value that will populate in that field?  Does it change per user, per category, per group??

    Jon



  • 6.  Re: setting a value to lookup field

    Posted Oct 10, 2017 04:27 PM

    Utku - also, why is it that you dont want to do this with a data partition constraint?  Any reason?

    Jon



  • 7.  Re: setting a value to lookup field

    Posted Oct 11, 2017 04:47 AM

    Hi Jon

     

    for problems I want to set the assignee by initial popup window but for request and incident I dont want that.

    there are also a couple custome fields with similar scenario



  • 8.  Re: setting a value to lookup field

    Posted Oct 11, 2017 08:39 AM

    Hi Utku,  when you say "set the assignee by initial popup window" what do you mean exactly?  Also are you looking to auto-populate the request and incident tickets with assignee?  I am a bit confused on to the exact scenario here - I need more information on that.  If you are looking to auto-populate the request and incident tickets, what do you want the assignee to populate with? How do you want to drive that value - or what do you want to base that value on?

    Please give us some clarification and a more complete use case so we can help you on this.

    Thanks

    Jon I.



  • 9.  Re: setting a value to lookup field

    Posted Oct 16, 2017 08:08 AM

    Hi Jon

     

    I think the scenarios are not important. My goal is to set default values for a few lookup fields which should not have the same value for request and problem. By default, I mean by clicking on New Request or New Problem link. 

     

    For example : for request I would like to set the group field to Group X but for problems I would like to set to Group Y.

     

    As I said, I have a lot of fields which should have different initial value for requests and problems

     

    Best Regards

    Utku



  • 10.  Re: setting a value to lookup field

    Posted Oct 16, 2017 09:21 AM

    Hi Utku,

    The only supported way to do that is to use data partition constraints (default type).  Outside of that it requires customization at the file level which is not supported, and we cannot assist you on that part as its outside of our scope.

    Is there a reason as to why you didnt want to use data partition constraints to do this?

    Let us know,

    Thanks,

    Jon I.



  • 11.  Re: setting a value to lookup field

    Posted Oct 17, 2017 02:23 AM

    Hi Jon,

     

    I think it's not possible with data constraint to set different default values for problem and requests, is it? There aren't different table names for problem and request.

     

    BR

    Utku



  • 12.  Re: setting a value to lookup field

    Posted Oct 17, 2017 08:32 AM

    Ah Yes you are correct - that will be a challenge.  For that you will need some custom code most likely.  I believe there is a way to do this via the forms (detail_cr vs. detail_pr), but its not something that I have played around with myself.  I know there are folks out here on the community that have set defaults via the forms in the code.  I found a couple of posts that might help you a bit here.

    Check out these two:

     

    https://communities.ca.com/message/241945668-re-different-default-priority-value-for-request-incident?commentID=24194566… 

     

    https://communities.ca.com/message/241969941-re-set-default-value-for-a-field-using-javascript?commentID=241969941#comme… 

     

    Let us know,
    Jon I.



  • 13.  Re: setting a value to lookup field
    Best Answer

    Posted Oct 25, 2017 04:06 PM

    Dear Jon

     

    Sorry for my late answer. Actually I found my own method. That's not actually I looked for but it worked for my case. 

    I set the assignee field readonly for the first initial problem page and then create a hidden field which will set the assignee as login user. 

     

    <PDM_IF "$args.id" == "0">

       <PDM_IF "$args..." = "X">
          <INPUT TYPE=hidden NAME=SET.assignee VALUE='$cst.id'>

       <PDM_ELIF "$args..." = "Y">

          <INPUT TYPE=hidden NAME=SET.assignee VALUE='$cst.supervisor_uuid.id'>

        </PDM_ELSE>
    </PDM_IF>

     

    As I said not the desired solution but for now it works.

     

    Thank you all for the ideas and support

     

    BR

    Utku



  • 14.  Re: setting a value to lookup field

    Posted Oct 25, 2017 04:13 PM

    Thanks Utku.

    I try my best to help wherever and however I can.  I am glad you got something to work for you at least to some extend.

     

    I will mark your own post as correct