Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

how change for the default open for planning status in Job

Posted on by 465

Hi community,

I have a question, when I create a new Job, I want use planning for the default and not open job.

could you help me, how i can modify in AL Code?.

Thank you, I will appreciate

pastedimage1678987953811v1.png

I tried to use a trigger, but still does not work

trigger Onnewrecord()
    begin
        Status := Status::Planning;
    end;

Categories:
  • Verified answer
    Manuel Lozada Profile Picture
    Manuel Lozada 465 on at
    RE: how change for the default open for planning status in Job

    Inge M. Bruvik

    Thank you, this is other way to do it. I appreciated

  • Manuel Lozada Profile Picture
    Manuel Lozada 465 on at
    RE: how change for the default open for planning status in Job

    YUN ZHU

    Thank you for helping me, now works perfect

  • Suggested answer
    Ben Baxter Profile Picture
    Ben Baxter 4,892 Super User 2024 Season 2 on at
    RE: how change for the default open for planning status in Job

    Rather than hard coding the status, it is better to add a field to the Job Setup table for "Default Job Status".  This way if you needed it to be something different in the future it wouldn't take a developer to change it.  As a non-developer, I can't stand hardcoded development.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,110 Super User 2024 Season 2 on at
    RE: how change for the default open for planning status in Job

    Hi, If you only want to run in Job Card, you can try the code below.

    pastedimage1679016891429v1.png

    pastedimage1679016899849v2.png

    But please note whether to use the Validate method, and the code of the Modify trigger needs to be run.

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: how change for the default open for planning status in Job

    You can try to use this even on the Job table:

    local procedure OnAfterOnInsert(var Job: Record Job; var xJob: Record Job)

       begin

       end;

    And set the status there.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,963 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans