web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Method not getting executed when called from the main method.

(0) ShareShare
ReportReport
Posted on by

hi,

i have written the below code and on debugging, the first method is not being executed, its not executing the method definition but it is executing the second method and going inside its definition

class HSUpdateCardDetails

{

public static void main(Args _args)
{
str multipleFields;
SalesLine salesLineLoc;
HSUpdateCardDetails updateCardDetails = new HSUpdateCardDetails();
multipleFields = _args.parm();
salesLineLoc= _args.record();

updateCardDetails.getCardDetails(multipleFields); // This method is not getting executed. it is directly executing the below one.
updateCardDetails.validateCardDetails(salesLineLoc);
updateCardDetails.updateCardDetails();
}

void getCardDetails(str _multipleLineFields)
{

con = str2con(_multipleLineFields,",");
hSGiftNum = conPeek(con,3);
hSGiftCard = HSGiftCard::find(hSGiftNum, false);


discAmount = conPeek(con,1);

custAccount = conPeek(con,2);

}

void validateCardDetails(SalesLine _salesLine)
{
salesLine = _salesLine;
select firstonly giftCardTransIssue
where giftCardTransIssue.GiftCardNumber == hSGiftNum
&& giftCardTransIssue.Operation == HSOperation::Issue;

if (discAmount >= giftCardTransIssue.Amount)
{
throw error ("@HSMasterGiftCard:ErrorInsufficientAmount");
}
else
{
if (SalesLine.LineAmount < discAmount)
{
throw error("@HSMasterGiftCard:ErrorMessageDiscountAmount");
}
}
}

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    236,279 Most Valuable Professional on at
    RE: Method not getting executed when called from the main method.

    Note that the version tag is "current version", i.e. AX 7, therefore there is no separate step for CIL compilation and no .auc files.

  • Suggested answer
    Alex Voytsekhovskiy Profile Picture
    on at
    RE: Method not getting executed when called from the main method.

    Compile the class

    Incremental  CIL

    Close the client and delete *.auc Local cache files.

    Restart AOS.

    Full CIL

    Full application compilation

    Try all these steps one by one. There is no other magic

  • Verified answer
    Martin Dráb Profile Picture
    236,279 Most Valuable Professional on at
    RE: Method not getting executed when called from the main method.

    Make sure your code is fully built. If it is, the method must execute, therefore the problem must be in how you identify whether it's executed or not. Please give us more information about the way how you debug it.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans