Skip to Content
Technical Articles
Author's profile photo Dhruvin Mehta

Create a MDR (Background Job) from ABSL : A simple approach!

We often come across scenarios when we need to create an MDR which needs to be executed via some action or event.

We will not go through entire MDR creation , since there are many blogs out there! 😉

However before going through the technicalites of the topic I would give you a brief on Use case and why we needed this.


Use Case :

Our scenario include Opportunities , So we have scenario like Main Opportunities and Child Opportunities and we have an action in our system which creates this kind of child opportunities.

After the child opportunites are created then Routing Matrix gets triggered and determines the parties which needs to work on those child opportunities. ( Define Rules for Opportunity parties )



So as you can see based on multiple criterias the parties are getting determined. Now in some case none of this conditions are met and the opportunity is “Unassigned” but how would we know that oppi is unassinged!!  Because routing matrix is called after saving , so before save code wont help!

so what to do!?  Thinking Face on Google Android 9.0

So ideally one cas use normal WF rules on created on and trigger the action to check! This will work just fine but sometimes System is still processing routing and the WF rules gets failed ( of course we can rerun it ) but we wanted a fallback job which checks if this child opportunity which got created is unassigned or not!

Implementation :

So as we know we have to create a customBO for our MDR since we cant create MDR on standard object ( Which is a limitiation but thats how system is designed )

A. Create a MDR

  1. Create a Bo and MDR and its screens.
  2. Create a query.
  3. Create and define Action.
  4. Workcenter View assignments

for details check  :

B. Call this MDR via ABSL

There is a import file import AP.PlatinumEngineering; which is designed for this!

Note : platinumengineering will not recieve 24/7 support and you can raise only in medium prio ticket if something goes wrong! 🙁 yeah but thats how it is!

  1.  Call the method from required event , in my case it is CreateChildOppi action which gets triggered from a butyton and then BeforeSave of Opport-Root (for child opportunities)
  2.  Created a method to Create MDR
  3.  Schedule-Start the MDR which in turn will call the action created in A.3.

B.1 Call the method with correct ID sequence createchild(buttton), beforesave

CreateChild method ( of course there is more code in this method but for this blog this is relavent)

var OppMaint : elementsof OppAssignMaint;
OppMaint.OpportId = Opp.ID;
var OppMaintBO : OppAssignMaint = OppAssignMaint.Create(OppMaint); 

OppAssignMaint is my custom BO , which is filled with ID from action

var OppMaint = OppAssignMaint.Retrieve(this.ID);

B.2 : Create MDR Action ( checkAssignmentStart)

import ABSL;
import AP.PlatinumEngineering;
var MDRO_ID : XPEString;
var QueryParam : QueryParameter;
var ParameterName : QueryParameter.ParameterName;

var MDRName = "BGJAssignment"; // This is the name of my MDR
var MDRNamespace = "";
MDRO_ID = this.GetFirst().OpportId.content; // This should be the ID for the run
var mdrCreateInstanceResult   = MDRO.CreateInstance( MDRName, MDRNamespace, MDRO_ID);

QueryParam.ParameterName = "SelectByOpportId"; //MyQuery 
QueryParam.Sign = "I";
QueryParam.Option = "EQ";
QueryParam.Low = this.GetFirst().OpportId.content;
var mdrAddParameterResult = MDRO.AddSelectionParameter(MDRName,MDRNamespace,"SelectByOpportId",MDRO_ID,QueryParam);

So break it down :  BGJAssignment is my MDR name in PDI

SelectByOpportId because OpportId is my query parameter

B.3 Schedule the MDR after few mins or seconds based on your requirments

import ABSL;
import AP.PlatinumEngineering;

var QueryParam : QueryParameter;
var MDRO_ID : XPEString;

var MDRName = "BGJAssignment";
var MDRNamespace = "";
var MessageList : MessageList;
var MessageText : MessageType.Text.content;
MDRO_ID =  this.GetFirst().OpportId.content;

var currentTime = Context.GetCurrentGlobalDateTime();
var min = 2;
var sec = 0;
var StartDuration = Library::Duration.Create ( 0, 0, 0, 0, min, sec ); // 5 sec
var startTime = currentTime.AddDuration (StartDuration);
MessageList = MDRO.ExecuteDateTime(MDRName,MDRNamespace,startTime,MDRO_ID);
MessageText = MessageList.MessageTypeItem.GetFirst().Text.content;


B.4 Check in your MDR screen if it worked or not 😉


This is it folks, I think this is pretty cool if you want a baground job to work for  related items or something! plus its in background so “Hopefully” performance will not hit on front end.


Please go through below blogs for more info :

Thank you so much if you have read till this 😀 and have a nice day!


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kumar Rituraj
      Kumar Rituraj

      Good one Dhruvin