Jump to content
Sign in to follow this  
profilmk

Auto insert chg ref num in custom table

Recommended Posts

Hi colleagues,

 

I have the following situation. A custom table i created, i have 6 columns. 2 of them are SREL, 1 with cnt and the other with chg table.

Now I can't manage to auto fill the chg field with chg_ref_num, to not do it manually for each row.

Any one have idea how to fill the value of chg_ref_num, or how to create relationship with custom table and chg table?

 

Thanks in front!

Share this post


Link to post
Share on other sites

Hi,

chg's outer key is id (type integer), so you need to fill it with change id, and then refer as: <change_attribute>.chg_ref_num

How do you creating an entry in your custom table?

Regards, cdtj

Share this post


Link to post
Share on other sites
On 2/15/2018 at 8:49 AM, cdtj said:

Hi,

chg's outer key is id (type integer), so you need to fill it with change id, and then refer as: <change_attribute>.chg_ref_num

How do you creating an entry in your custom table?

Regards, cdtj

I do it manually I insert new record where manually I add values for cnt, chg num and some other values. 

how do I refer to <change_attribute>.chg_ref_num, what is the <change_attribute> in this case?

Share this post


Link to post
Share on other sites

change means chg (Change Order), feels like there should be nothing special and simple dtlLookup macro without any other params should trigger autocompletion.

<PDM_MACRO name=dtlLookup hdr="Change Order" attr="chg">

 

Share this post


Link to post
Share on other sites

oh, if I misunderstood you and you want to predefine chg on your custom form you can use PRESET functionallity:

// in URL: +PRESET=<attr_name>:<rel_attr>
// example, where 12345 is id and z_chg is your attr name:
+PRESET=z_chg:12345
// or if you want to predefine chg using chg_ref_num, where 54321 is ref num:
+PRESET_REL=z_chg:chg.id:chg_ref_num:54321

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 2/19/2018 at 3:51 PM, cdtj said:

oh, if I misunderstood you and you want to predefine chg on your custom form you can use PRESET functionallity:


// in URL: +PRESET=<attr_name>:<rel_attr>
// example, where 12345 is id and z_chg is your attr name:
+PRESET=z_chg:12345
// or if you want to predefine chg using chg_ref_num, where 54321 is ref num:
+PRESET_REL=z_chg:chg.id:chg_ref_num:54321

 

Ok, I will explain more detail to not misguide.

I have table z_table which is lrel table with chg and cnt.

In z_table i have 3 columns: z_chg (srel on chg), z_cnt (srel on cnt), z_data (string) and z_date.

I have nested z_table on CO in a new tab with list form (list_z_table.htmpl) and i have "create new" button and other ootb butons.

Now when i click on the create new button i enter new record (detail_z_table.htmpl), I choose the cnt, i chose date and i write text, and how is set i enter ref num manually or dtlLookup. What i need is when i click create new and it opens, to automatically add chg ref num from the change order from where i started the record. Basically to create relationship with the related change order. 

Share this post


Link to post
Share on other sites

I think I'm getting what you suggesting cdtj, I am supposed to add PRESET on the URL of the Create New button?

If yes, where can i locate the Create New button to modify URL?

create new.png

Edited by profilmk

Share this post


Link to post
Share on other sites

you can redefine create button using sfStart pdm_macro: https://docops.ca.com/ca-service-management/14-1/en/building/building-ca-service-desk-manager/using-the-web-screen-painter-wsp/pdm-macro-definitions#PDMMacroDefinitions-sfStartas I remember you need to pass own javascript function as extraCreateURL, ex:

<PDM_MACRO name=sfStart extraCreateURL="zCreateBREL">
function zCreateBREL() {
create_new('z_table', <few attrs like window height/width>, 'PRESET=z_chg:$args.KEEP.chg_id');
}

Its a good practice to use KEEP array to pass through id from main form to tab:

<PDM_MACRO NAME=tab SRC="OP=SEARCH+FACTORY=z_table+KEEP.chg_id=$args.id...<some_other_params>">

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 2/22/2018 at 7:56 PM, cdtj said:

you can redefine create button using sfStart pdm_macro: https://docops.ca.com/ca-service-management/14-1/en/building/building-ca-service-desk-manager/using-the-web-screen-painter-wsp/pdm-macro-definitions#PDMMacroDefinitions-sfStartas I remember you need to pass own javascript function as extraCreateURL, ex:


<PDM_MACRO name=sfStart extraCreateURL="zCreateBREL">
function zCreateBREL() {
create_new('z_table', <few attrs like window height/width>, 'PRESET=z_chg:$args.KEEP.chg_id');
}

Its a good practice to use KEEP array to pass through id from main form to tab:


<PDM_MACRO NAME=tab SRC="OP=SEARCH+FACTORY=z_table+KEEP.chg_id=$args.id...<some_other_params>">

 

It works like a charm, thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Announcements

    • Gregg

      Looking for the wiki content?

      12/20/2015

      Until I can transfer the wiki content over to the new Articles, you can find the old content here: http://www.greggsmith.net/wiki.
    • Gregg

      New site logo

      01/06/2016

      A special thanks to brianshs for creating a new site logo!
×