CA Service Management

Expand all | Collapse all

Suppressing specific attributes when Copying Contacts

  • 1.  Suppressing specific attributes when Copying Contacts

    Posted Feb 10, 2016 09:30 PM

    We have a requirement to have certain fields (some out-of-the-box, some custom) cleared when a Contact record is copied via the GUI.

     

    We know all about the functionality to achieve this for Inc/Req/Prb, COs and Issues by updating the over-riding methods like cr::copy_cr_site in tmplcopy_site.spl but that is obviously specific to those object types as a 'bop_sinfo -m cnt' doesn't show any equivalent method.

     

    We are using r12.6 of SDM.

     

     

    Does anyone know how to do this for Contacts?

     

     

    Thanks,

     

    Alan



  • 2.  Re: Suppressing specific attributes when Copying Contacts
    Best Answer

    Posted Feb 11, 2016 02:34 AM

    Every object that has a 'Copy' option implements the 'make_<fac>_copy' method - for Contacts it's make_cnt_copy. You can override the make_cnt_copy function in a custom .spl file and define your own. You have to remember that this method runs in the context of the copied object and it receives a Group Leader as a parameter, so you don't actually need to save anything, the system will save it for you.

    Example:

    cnt::make_cnt_copy(...)

    {

      string func_name; func_name = "cnt::make_cnt_copy";

     

      object gl; gl=argv[0];

     

      // Get a new Object

      send_wait(0, top_object(), "call_attr", "cnt", "get_new_dob", NULL, NULL, gl);

     

        if (msg_error()) {

            logf(ERROR, "%s cannot create a new Object: %s", func_name, msg[0]);

            return;

        };

       

      object new_dob;

      // Copy the fields from an existing object to the new Object

      new_dob = msg[0];

      new_dob.first_name = first_name;

      new_dob.notes = notes;

     

      // TODO: add your specific fields here.

     

    // Return the new object

      set_return_data( new_dob );

        

       

    }



  • 3.  Re: Suppressing specific attributes when Copying Contacts

    Posted Feb 14, 2016 02:45 PM

    That's just what I need to know. Thanks , Cristi



  • 4.  Re: Suppressing specific attributes when Copying Contacts

    Posted Feb 14, 2016 11:28 PM

    Thanks all.

     

    Flagging Cristi's post as "Correct Answer."

     

    Kyle_R.



  • 5.  Re: Suppressing specific attributes when Copying Contacts

    Posted Jun 21, 2017 02:25 PM

    Great! Works!