nerdexam
Microsoft

MB-500 · Question #21

You are a Dynamics 365 Finance developer. You must extend the validateWrite method of the SalesLine table by using Chain of Command. The value of a variable named SalesPrice must be greater than or…

The correct answer is B. [ExtensionOf(tableStr(SalesLine))] final class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck = false) { boolean ret; ret = next validateWrite(_skipCreditLimitCheck); if (ret && this.SalesPrice < 0) { ret = false; } return ret; } } D. [ExtensionOf(tableStr(SalesLine))] final class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck) { boolean ret; try { ret = next validateWrite(_skipCreditLimitCheck); } catch (Exception::Error) { ret = false; } if (ret && this.SalesPrice < 0) { ret = false; } return ret; } }. Incorrect Answers: B: Can't use = false in the 4th line. C: Second line must be start final class, public class https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/validations- defaults-unmapped-fields…

Develop business logic

Question

You are a Dynamics 365 Finance developer. You must extend the validateWrite method of the SalesLine table by using Chain of Command. The value of a variable named SalesPrice must be greater than or equal to zero when adding new lines. You need to create an extension class. Which two code segments can you use? Each correct answer presents a complete solution. NOTE: Each correct selection is worth one point. A. B. C. D.

Exhibits

MB-500 question #21 exhibit 1
MB-500 question #21 exhibit 2
MB-500 question #21 exhibit 3
MB-500 question #21 exhibit 4

Options

  • A[ExtensionOf(tableStr(SalesLine))] final class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck) { boolean ret; ret = next validateWrite(_skipCreditLimitCheck); if (ret && this.SalesPrice < 0) { ret = false; } return ret; } }
  • B[ExtensionOf(tableStr(SalesLine))] final class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck = false) { boolean ret; ret = next validateWrite(_skipCreditLimitCheck); if (ret && this.SalesPrice < 0) { ret = false; } return ret; } }
  • C[ExtensionOf(tableStr(SalesLine))] public class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck) { boolean ret; ret = next validateWrite(_skipCreditLimitCheck); if (ret && this.SalesPrice < 0) { ret = false; } return ret; } }
  • D[ExtensionOf(tableStr(SalesLine))] final class SalesLine_Extension { boolean validateWrite(boolean _skipCreditLimitCheck) { boolean ret; try { ret = next validateWrite(_skipCreditLimitCheck); } catch (Exception::Error) { ret = false; }
        if (ret && this.SalesPrice < 0)
        {
            ret = false;
        }
        return ret;
    }
    
    }

How the community answered

(32 responses)
  • A
    31% (10)
  • B
    56% (18)
  • C
    13% (4)

Explanation

Incorrect Answers: B: Can't use = false in the 4th line. C: Second line must be start final class, public class https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/validations- defaults-unmapped-fields https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-

Topics

#Chain of Command#validateWrite#extension class syntax#X++ CoC

Community Discussion

No community discussion yet for this question.

Full MB-500 Practice