Thursday, April 21, 2016

Easy Search Match Piece of Code for CRM

This is a pretty sleek implementation for PeopleSoft CRM applications.

Function Search_match(&strFirst_name, &strLAST_NAME, &strBIRTHDATE, &strEMAILID) Returns string;
   Local Record &ANO_PERS_TBL;

   &oPersonSrchType = create HCR_PERSON_TYPES:Person:PersonSrchType_v1_0:PersonSrchType();
   &oCollPersonSrchResultType = create HCR_PERSON_TYPES:Person:PersonSrchResultType_v1_0:collPersonSrchResultType();
   &oPersonSrchRuleType = create HCR_PERSON_TYPES:Person:PersonSrchRuleType_v1_0:PersonSrchRuleType();
   /* Comment by Anoop: You can either explicitly add the SM criteria here or can use the context based assignment */
   &oSearchMatch = create RB_SEARCH_MATCH_INTERFACE:HRSearchMatch("ANO_CR_CONSUMER");
   Local Record &ANO_SEARCH_MATC = CreateRecord(Record.ANO_SEARCH_MATC);
   &ANO_SEARCH_MATC.FIRST_NAME.Value = &strFirst_name;
   /* Comment by Anoop: Trigger the search match here */
   &oSearchMatch.PerformSearch(&oPersonSrchType, &oCollPersonSrchResultType, %Date);

   Local string &action = &oCollPersonSrchResultType.results_action;
   Local number &nMatches = &oCollPersonSrchResultType.number_matches;
   Local number &bo_id;
   If &nMatches > 1 Then
      If &bEIPDebug Then
         MessageBox(0, "", 0, 0, "%1 matches found, person will be added", &nMatches);
   If &bEIPDebug Then
      MessageBox(0, "", 0, 0, "Results_action is %1", &action);
   Return &action;

Use the &action variable for the person Creation/Update

Copyright © Tech Notes