Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

suitecrm - How to create a logic hook `after_relationship_add` & `before_relationship_delete` based on info in subpanels

I have two custom modules Cases and ProductInvestigation that shares a one to many relationship. I would like to use logic hook to send an email once the relationship is added. This is what I have so far as it relates to relationship aspect I'm not sure.

function createPIEmailwithCases(&$email,$action_array,$bean,$xtpl){

    /* Get PI Number */

    $xtpl->assign('PI_Number', $bean->pinum_c);
    
    /* Get PI Subject */
    $xtpl->assign('PI_Subject', $bean->name);
    
    /* Get Product Name */
    $xtpl->assign('Product_Name', $bean->product_name_c);
    
    /* Get Product Type */
    $xtpl->assign('Product_Type', $bean->type_of_product_c);
    
    /* Get Batch # */
    $xtpl->assign('Batch_Number', $bean->batch_c);
    
    /* Get Size(s) */
    $xtpl->assign('Size', $bean->size_c);
    
    /* Get Fill Date */
    $xtpl->assign('Fill_Date', $bean->filldate_c);
    
    /* Get Batch # */
    $xtpl->assign('BestBefore', $bean->bestbefore_c);

    /* Get PI Description */
    $xtpl->assign('PI_Desc', $bean->description);
    
            
    /* Get Reviewer Name */
    $xtpl->assign('Reviewed_By',$bean->reviewer_c);
    $xtpl->assign('Review_Date',$bean->review_date_c);

    
     if ($arguments['related_module'] =='Cases'){
    $bean->new_case_c =$arguments['related_id'];
      //do something

    }
    
    
    /* Create email message using email template and data above */
    $xtpl->parse('block');
    $email->Body = from_html($xtpl->text('block'));
    
    return $email;
}
question from:https://stackoverflow.com/questions/65892991/how-to-create-a-logic-hook-after-relationship-add-before-relationship-delet

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...