CA Service Management

  • 1.  Help on Lookup Field

    Posted Aug 22, 2018 02:33 PM


    Hi guys,

     

    I'm having some difficulties creating a lookup field to bring users from SDM in order to notify this contact contained in this field.

     

    I created the data object for use in ca_fdDoFieldLookup according to the query below:

     

    ID: caContactPlugin

    Database: mdb

    Table: ca_contact

    Fields: value, label

    Query:

    select contact_uuid as value, last_name as label from mdb.dbo.ca_contact where userid is not null

     

    In the form i created a lookup field with the following attributes:

     

    _id: ca_sdm_attr_z_SuperiorImediato (this custom attribute is a SREL from the cnt factory)

    onLookup: ca_fdDoFieldLookup ('last_name', 'caContactPlugin')

     

    When I select the field to view the values it does not give me a search option or even allows users to search with the value entered in the lookup field.

     

    Is there anything I should do besides creating this query and making the field available?

     

    Bellow the form and popup lookup field:

     

     

     

    Many thanks for your help!



  • 2.  Re: Help on Lookup Field

    Posted Aug 22, 2018 05:51 PM

    Hi Diego,

     

    You need to pass the _id of the lookup field as the first argument similar to the following:

     

    ca_fdDoFieldLookup('ca_sdm_attr_z_SuperiorImediato', 'caContactPlugin');

     

    Also, note that the form field(s) that you want populated with the results of this lookup need to have the same _id as the column/alias in your data object. As an example, if you want the lookup field populated with the last_name from the data object you would either need to specify the lookup field _id as 'label' or update your query to alias last_name as 'ca_sdm_attr_z_SuperiorImediato'.

     

    Thanks,
    Jason



  • 3.  Re: Help on Lookup Field

    Broadcom Employee
    Posted Aug 23, 2018 03:17 AM

    Good Morning Diego.

    The following is an example to get this working.

    In sc/admin/report builder, create a data object.
    type = query
    id = catalog_contact_list
    database = mdb
    table = ca_contact
    fields = userid,first_name,last_name
    query = SELECT userid,first_name,last_name
    FROM ca_contact
    WHERE upper(userid) like upper('%STRING%%%')

    In SC/Catalog/Forms, create a form with:
    A: The Lookup component on the form:
    _id = userid
    onLookup= ca_fdDoFieldLookup('userid','catalog_contact_list')

    NOTE: userid is the first field of the data object fields.
    id-value is the id of the data object

    B: The 'text field' component on the form is the field to be filled with data from lookup:
    _id = first_name
    _id = last_name
    The value for '_id' must be equal to the field in the data object.
    And will then be automatically populated when the query executes.
    E.G. for another text field on the form,
    to be populated with the contact's first_name (as in the query-text), the _id of that field must/should be first_name too.

    Does this answer your question? And help you further on this?

    PS.
    When you change the query into:
    query =
    SELECT userid,first_name as firstname,last_name as lastname
    FROM ca_contact
    WHERE upper(userid) like upper('%STRING%%%')

    Then the _id of th fields on the form should be firstname and lastname.
    Equal to the ones that you use in the 'as' clause in the query-text.

    Thanks and kind regards, Louis van Amelsfort.



  • 4.  Re: Help on Lookup Field

    Posted Aug 27, 2018 10:32 AM

    Hi guys,

     

    Many thanks for all the help!

     

    I have changed my query to search the user based on last_name, however, when i try to select this user on the offer the value presented in the popup is not populated on the form.

     

    Theres something that i can do to make this values "saved" onf the offer form?

     

    Popup asking for the user name:

     

     

    Value is not available on offer:

     

     

    Many thanks again!



  • 5.  Re: Help on Lookup Field

    Posted Aug 29, 2018 10:55 AM

    The form field(s) that you want to populate from the option selected in the lookup popup window need to be defined with an _id that matches the column/alias returned from your data object.



  • 6.  Re: Help on Lookup Field

    Broadcom Employee
    Posted Aug 30, 2018 02:00 AM

    Good Morning Diego.

     

    As to confirm Jason's comment, this is also mentioned in the info as provided earlier:

    B: The 'text field' component on the form is the field to be filled with data from lookup:
    _id = first_name
    _id = last_name
    The value for '_id' must be equal to the field in the data object.
    And will then be automatically populated when the query executes.
    E.G. for another text field on the form, 
    to be populated with the contact's first_name (as in the query-text), the _id of that field must/should be first_name too.

     

    Kind regards, Louis.