Topic
  • 2 replies
  • Latest Post - ‏2012-04-16T22:33:16Z by OmNaidu
OmNaidu
OmNaidu
5 Posts

Pinned topic Copy Parent record fields to Child record for the same record types?

‏2012-04-16T19:30:50Z |
I am looking for a perl hook that can copy the headline,description and few other fields of the parent record to the corresponding fields in the child record when the new button is clicked on the parent child link of the parent records. If anyone has this perl, please share with me.
  • aoc_admin
    aoc_admin
    25 Posts

    Re: Copy Parent record fields to Child record for the same record types?

    ‏2012-04-16T20:24:07Z  
    Hi Om,

    I use VB, but should be the same in perl and here's the pseudo code

    New button pre-action hook
    set session = getsession
    session.namevalue "parent_headline_variable", getfieldvalue("headline").getvalue
    session.namevalue "parent_desc_var", getfieldvalue(desc).getvalue
    and so on

    then new button post action hook
    clear the session variables by
    session.namevalue "variable", ""
    in the child's submit action hook initialization
    if session.namevalue("FromParent"), "Yes" then
    setfieldvalue "headline", session.namevalue("parent_headline_value")
    setfieldvalue "description", session.namevalue("parent_desc_var")

    hope that helps

    Nandita
  • OmNaidu
    OmNaidu
    5 Posts

    Re: Copy Parent record fields to Child record for the same record types?

    ‏2012-04-16T22:33:16Z  
    • aoc_admin
    • ‏2012-04-16T20:24:07Z
    Hi Om,

    I use VB, but should be the same in perl and here's the pseudo code

    New button pre-action hook
    set session = getsession
    session.namevalue "parent_headline_variable", getfieldvalue("headline").getvalue
    session.namevalue "parent_desc_var", getfieldvalue(desc).getvalue
    and so on

    then new button post action hook
    clear the session variables by
    session.namevalue "variable", ""
    in the child's submit action hook initialization
    if session.namevalue("FromParent"), "Yes" then
    setfieldvalue "headline", session.namevalue("parent_headline_value")
    setfieldvalue "description", session.namevalue("parent_desc_var")

    hope that helps

    Nandita
    Thanks Nandita.

    Let me work on the perl side of it.

    Om