Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Creating a simple sysFramework batch with a query as parameters

(0) ShareShare
ReportReport
Posted on by 175

I am trying to create a sysFramework batch which creates a purchaseOrder based on a tender.

For this I am trying to add a query to my batch operation. I tried using KanbanPrinterBatch as an example, but I cannot choose any parameters.

My contract class:

[DataContractAttribute]
class CreatePurchaseOrdersForTendersContract
{
str packedQuery;

public Query getQuery()
{
return new Query(SysOperationHelper::base64Decode(packedQuery));
}

[
DataMemberAttribute,
AifQueryTypeAttribute('_packedQuery', queryStr(BWI_TenderPurchaseOrders))
]
public str parmPackedQuery(str _packedQuery = packedQuery)
{
packedQuery = _packedQuery;
return packedQuery;
}

public void setQuery(Query _query)
{
packedQuery = SysOperationHelper::base64Encode(_query.pack());
}

}

My controller:

class CreatePurchaseOrdersForTendersController extends SysOperationServiceController
{

public static void main(Args _args)
{
CreatePurchaseOrdersForTendersController::newStandard(_args).startOperation();
}

public static SysOperationController newStandard(Args _args)
{
SysOperationController controller = new CreatePurchaseOrdersForTendersController(classStr(CreatePurchaseOrdersForTendersService));
controller.parmArgs(_args);
controller.parmDialogCaption("Create purchase orders for tenders");
return controller;
}

}

My service class only contains a simple process() method at this moment. The problem however, when I click on my menu-item and the sidepanel of the batch opens, the header called 'Records to include' somehow does not render at all.

Question 1:

I assume I'm missing just one simple thing or so, but I am not getting any errors anywhere. Does anyone know what I am missing?

I read somewhere you can use initQuery to change the query setup and it then has to be called in the controller class. I can see that the Kanban contract class does have an initialize method, but I do not see that getting called.

Question 2:

If I wanted to make some changes to my query via an init method, am I supposed to call it then or how is this initialize method of the kanban contract called when I can't find any references? 

  • Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    RE: Creating a simple sysFramework batch with a query as parameters

    No, the framework doesn't assume any default method name. It must be specified in some way.

  • Superbunny Profile Picture
    Superbunny 175 on at
    RE: Creating a simple sysFramework batch with a query as parameters

    Ah thanks! I indeed removed, seeing it was optional.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,836 Most Valuable Professional on at
    RE: Creating a simple sysFramework batch with a query as parameters

    Your controller doesn't say anywhere that process() method should be used. You need to do it either in the constructor (I tend to override it and doing it there) or pass it through parmMethodName() in newStandard().

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,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans