Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

When WorkflowWorkItemQueueCustomProvider class will get triggered

(0) ShareShare
ReportReport
Posted on by 170

Hi there,

I'm working on a bug in case sync integration, where the outbound API is called in WorkflowWorkItemQueueCustomProvider extension class and i tried all the ways by debugging but i'm not getting when this class will get called actually after clicking on submit button of workflow it has call but it is not calling this and in this class they are passing queue names dynamically which are there in work item queues, can someone please help on when this class will get called.

  • Ganesh Potnuru Profile Picture
    Ganesh Potnuru 170 on at
    RE: When WorkflowWorkItemQueueCustomProvider class will get triggered

    [extensionof(ClassStr(WorkflowWorkItemQueueCustomProvider))]
    final class WorkflowWorkItemQueueCustomProvider_Extension
    {
    
        public Name queueIdToQueueName(WorkflowQueueId _queueId)
        {
            WorkflowWorkItemQueue workItemQueue;
    
            next queueIdToQueueName(_queueId);
    
            if(workItemQueue.FOCECaseActionOnCE == NoYes::Yes)
            {
                info("Reassign to new workitem que");
            }
            return workItemQueue.Name;
        }
        public Name resolve( WorkflowContext _context,
                             WorkflowQueueToken _queueToken)
        {
            WorkflowWorkItemQueueExpression     queueExpression;
            WorkflowWorkItemQueue               workItemQueue,WorkflowWorkItemQueue_1;
            WorkflowWorkItemQueueExpressionDef  queueExpressionDefinition;
            ExpressionTable                     expression;
            ExpressionResultType                result;
            Name                                queueName;
            SysDictWorkflowType                 workflowType;
            className                           workflowDocument;
            SysWorkflowTable                    sysWorkflowTable;
            CaseDetailbase                      caseDetailBase,caseDetailBaseupd;
    
            sysWorkflowTable = SysWorkflowTable::find(_context.parmWorkflowCorrelationId());
            next resolve(_context,_queueToken);
    
            select caseDetailBase where caseDetailBase.RecId == _context.parmRecId();       
            
            workflowType = SysDictWorkflowType::newTypeName(sysWorkflowTable.TemplateName);
          
            workflowDocument = workflowType.document();
    
            while select EvaluationOrder, Expression, WorkflowWorkItemQueue from queueExpression
                order by EvaluationOrder
                join Status, Name, RecId  from  workItemQueue
                    where   queueExpression.WorkflowWorkItemQueue == workItemQueue.RecId
                        &&  workItemQueue.Status == WorkflowWorkitemQueueStatus::Active
                        &&  workItemQueue.WorkitemType == workflowDocument
                join RecId, ExpressionId from expression
                    where queueExpression.Expression == expression.RecId
            {
                result = Expression::evaluate(_context.parmCompanyId(),_context.parmTableId(),
                                                _context.parmRecId(),expression.ExpressionId);
    
                if (result == ExpressionResultType::True)
                {
                    queueName = workItemQueue.Name;
                    break;
                }
            }
    
            if(queueName)
            {
                changecompany(curExt())
                {
                    select WorkflowWorkItemQueue_1 where WorkflowWorkItemQueue_1.Name == queueName;
                    if(WorkflowWorkItemQueue_1.FOCECaseActionOnCE == NoYes::Yes && !caseDetailBase.CeCaseId)
                    { 
                        
                            //send case detil to CE and update the casedetail form action on field value to CE
                            FOCEOutboundIntegration FOCEOutboundIntegration = new FOCEOutboundIntegration();
                            FOCEOutboundIntegration.assignjsonValues(caseDetailBase,"In process");
                            // update action on field value to CE
                            ttsbegin;
                            select forUpdate  caseDetailBaseupd where caseDetailBaseupd.RecId == _context.parmRecId();
                            if(caseDetailBaseupd)
                            {
                                caseDetailBaseupd.ActionOn = ActionOn::CE;                           
                                caseDetailBaseupd.update();
                            }
                            ttscommit;  
                        
                    }
                }
            }
    
            if (!queueName)
            {
                select RecId, DefaultQueue from queueExpressionDefinition
                    where queueExpressionDefinition.WorkitemType == workflowDocument
                        && queueExpressionDefinition.DefaultQueue != 0;
    
                if (queueExpressionDefinition.RecId)
                {
                    queueName = WorkflowWorkItemQueue::find(queueExpressionDefinition.DefaultQueue).Name;
                }
            }
         
    
            return queueName;
        }
        }

    Hi Girish,

    Can you please tell me when WorkflowWorkItemQueueCustomProvider  willl get triggered, i have followed the above steps but still it is not getting triggered,

    Actually this development is a case sync integration development, so whenever a case is created in F&O and submit workflow then the earlier developer triggering the api to send this to CE in WorkflowWorkItemQueueCustomProvider  class but this class itself is not calling after i'm submitting the workflow.

    Basically in the above code in line number 52 they are calling api to tirigger outbound to CE but this class and resolve itself is not triggering after workflow submission.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: When WorkflowWorkItemQueueCustomProvider class will get triggered

    resolve method is called from the SysWorkflowQueueProvilder >> resolveQueue (Refer to line number 60).

    Actually, WorkflowWorkItemQueueCustomProvider  implements WorkflowQueueProvider  interface. So, the method declaration is available in interface and its definition is given in WorkflowWorkItemQueueCustomProvider.

    This resolve method is called from interface class which is WorkflowQueueProvider.

    Thanks,

    Girish S.

  • Ganesh Potnuru Profile Picture
    Ganesh Potnuru 170 on at
    RE: When WorkflowWorkItemQueueCustomProvider class will get triggered

    Hi huijij ,

    Yes I'm trying to call resolve method but I'm not getting on what action that method will get triggered.

  • Suggested answer
    huijij Profile Picture
    huijij 19,811 on at
    RE: When WorkflowWorkItemQueueCustomProvider class will get triggered

    Hi sir,

    Did you checked the methods in the WorkflowWorkItemQueueCustomProvider class and are you trying to call one of them? Could you please elaborate on your business requirements?

    760105.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans