System Admin and Configuration

Get Involved. Join the Conversation.


    Sebastiaan Draaisma
    Set org id for contact through CPMAnswered
    Topic posted April 13, 2019 by Sebastiaan DraaismaBlack Diamond: 60,000+ Points, last edited April 15, 2019 
    94 Views, 4 Comments
    Set org id for contact through CPM

    .Hi there.

    I'm trying to set the org id for a contact object on create or update but it tells me it's for read-only. Does anyone have example for me to look at?


    Best Comment

    Sebastiaan Draaisma

    Issue is resolved, everything works now as it should :-)



    • Sebastiaan Draaisma

      I solved my issue :-)
      When setting an org id for a contact you just leave the ID out

      $object->Organization = $var;

      • Robert Surujbhan

        Hi Sebastiaan, if you had a valid org ID (a true integer), another/more common way is the following (assuming "RNCPHP" is properly namespaced to the Connect library in your script):

        $object->Organization = RNCPHP\Organization::fetch($org_id);
    • Sebastiaan Draaisma

      Hi Robert.

      Thanks for replying

      I'm not sure if what I'm doing is the right way (kind of new to CPM). I'm doing some testing in my personal demo site with privileged answers and SLA assigned to orgs so that only specific companies get access to different answers based on org. In my setup I will have 3 customers that would need to see 3 different sets of answers. The answer and SLA setup is straightforward and working but the things is...

      Business rules for contacts do not have the Org fields in the THEN section preventing the use of a regular expression on the primary email and assigning it an org id. So my idea was to experiment a little with CPM and retrieve the contact primary email address and match this with 3 custom configuration settings in which the domain name resides. The configs are retrieved in the CPM and then there will be a PHP switch looking for a preg_match and assigns an org id (set in 3 other config settings). This way the CPM would not need to be modified. But I experienced some issues.

      So I don't know if I should use the Org object in the CPM as I'm only working with the contact object.
      I hope my explanation makes any sense? :-)

    • Sebastiaan Draaisma

      Issue is resolved, everything works now as it should :-)