Wednesday, June 19, 2019

D365FO - Add new participant and type of participant to Participant workflow element

There are times when you want to add a new type of participant other than security role participants and user group participants, this post describes the steps to take and achieve this requirement.

This is the final output































Let's find out how did it work.

This is how each type of participant exists in AOT so a new Workflow Participant Assignment Provider needs to be created in order to see it in the Type of participant list as for this example 'Vendor invoice approval provider' is being added.
Created a new Workflow Participant Assignment Provider with the following properties.

Available For All Workflow Templates = No [Just want to have this new Participant type vendor invoice approval workflow]

Added new workflow type and link it with VendInvoiceApprovalJournalTemplate which is the workflow type name for Vendor tax invoice approval journal workflow 



Each provider has a Provider class and here is an example of the class used for above created participant provider

class FF_VendInvoiceWFParticipantProviderExpend  extends WorkflowParticipantProvider_Expend
{
    const str owner = 'OWNER';

    public WorkflowParticipantExpenDocumentType documentType()
    {
        return WorkflowParticipantExpenDocumentType::VendInvoice;
    }

    public WorkflowParticipantTokenList getParticipantTokens()
    {
        WorkflowParticipantTokenList tokenList = WorkflowParticipantTokenList::construct();

        tokenList = super();
        tokenList.add(owner, '@SYS77709');
        return tokenList;
    }

    /// <summary>
    ///     Resolves the vendor invoice line dimensions to a list of users
    /// </summary>
    /// <param name="_context">
    ///     An instance of the <c>WorkflowContext</c> class
    /// </param>
    /// <param name="_participantTokenName">
    ///     The participant token that is selected for a role-based assignment.
    /// </param>
    /// <returns>
    ///     An instance of the <c>WorkflowUserList</c> class that contains the enabled users from the token
    /// </returns>
    /// <exception cref="M:Exception::Error">
    ///     Participant token does not exist
    /// </exception>
    public WorkflowUserList resolve(WorkflowContext _context, WorkflowParticipantToken _participantTokenName)
    {
        LedgerJournalTable ledgerJournalTable = this.getLedgerJournalTableFromContext(_context);

        WorkflowUserList userList = WorkflowUserList::construct();
       
        if (_participantTokenName == owner)
        {
            userList.add(DirPersonUserEx::worker2UserId(LedgerJournalTable::findRecId(_context.parmRecId()).FF_Originator));
        }

        return userList;
   
    }    

    /// <summary>
    /// Gets the <c>LedgerJournalTable</c> record from the workflow context.
    /// </summary>
    /// <param name = "_context">The workflow context.</param>
    /// <returns>A <c>LedgerJournalTable</c> record.</returns>
    private LedgerJournalTable getLedgerJournalTableFromContext(WorkflowContext _context)
    {
        LedgerJournalTable ledgerJournalTable;

        if (_context.parmTableId() == tableNum(LedgerJournalTable))
        {
            ledgerJournalTable = LedgerJournalTable::findRecId(_context.parmRecId());
        }
        else if (_context.parmTableId() == tableNum(LedgerJournalTable))
        {
            ledgerJournalTable = LedgerJournalTrans::findRecId(_context.parmRecId(), false).ledgerJournalTable();
        }

        return ledgerJournalTable;
    }

    /// <summary>
    /// Validates that the <c>WorkFlowContext</c> has the expected tables.
    /// </summary>
    /// <param name = "_context">The workflow context.</param>
    /// <returns>true if the expected tables are found; otherwise, false.</returns>
    private boolean doesContextHaveExpectedTable(WorkflowContext _context)
    {
        return _context.parmTableId() == tableNum(LedgerJournalTable) || _context.parmTableId() == tableNum(LedgerJournalTrans);
    }

    public static FF_VendInvoiceWFParticipantProviderExpend construct()
    {
        return new FF_VendInvoiceWFParticipantProviderExpend();
    }

}

If your interested to know how it used to work in AX 2012, follow this link https://dynamicsnavax.blogspot.com/2009/12/ax-workflow-direct-approver.html

21 comments:



  1. My name is Leah Brown, I'm a happy woman today? I told myself that any loan lender that could change my life and that of my family after having been scammed separately by these online loan lenders, I will refer to anyone who is looking for loan for them. It gave me and my family happiness, although at first I had a hard time trusting him because of my experiences with past loan lenders, I needed a loan of $300,000.00 to start my life everywhere as single mother with 2 children, I met this honest and God fearing online loan lender Gain Credit Loan who helped me with a $300,000.00 loan, working with a loan company Good reputation. If you are in need of a loan and you are 100% sure of paying the loan please contact (gaincreditloan1@gmail.com)

    ReplyDelete
  2. Business and Personal Loans, Loans ranging from $5,000-$100,000,000.

    We Offer suitable financial services Globally,Business and Personal Loans, Loans ranging from $5,000-$100,000,000.Our passion is helping ones in need.Feel free to engage our leased facilities as We have provided over $2 Billion in business loans to over 25,000 business owners just like you. We use our own designated risk technology to provide you with the right business loan so you can grow your business. Our services are fast and reliable, loans are approved within 24 hours of successful application. * Personal loans, * Truck Loans * Car Loans * Real Estate Loans * Refinancing Loans * Debt consolidation loans * Education Loans * Farm Loans * Corporate Loans * Business Start-up Loans We offer loans from a minimum range of $5,000 to a maximum of $500 million, Better loan services Will give you loan with an affordable interest rate of 3% and loan duration of 1 to 30 years to pay back the loan (secure and unsecured). Our aim is to provide Excellent Professional Financial Services. Intermediaries/Consultants/Brokers are welcome to bring their clients and are 100% protected. In complete confidence, we will work together for the benefits of all parties involved. Do not keep your financial problems to yourself in order for you not to be debt master or financial stress up, which is why you must contact us quickly for a solution to your financial problems. It will be a great joy to us when you are financially stable Email us via: betterloancompany@gmail.com.Better loan firm We are certified and offer fast and reliable services.(betterloancompany@gmail.com)

    ReplyDelete
  3. "Greetings to You,

    2% LOAN OFFER, We are Certified to Offer the following Kinds Of Loans * Personal Loan(Unsecured) * Business loan (Unsecured) * Debt Consolidation Loan *Improve your home * Investment Loan.

    We are privilege to meet your financial needs. The issue of credit shouldn't stop you from getting the loan that you need. we can finance up to the amount $10,000 to $100,000,000 in any region of the world as long as our 2% ROI can be guaranteed on the projects.

    If you are interested, please contact us today E-mail: nodebtloan@gmail.com with the following information below:

    Full Name:

    Employment status:

    Amount of Loan requested:

    Country:

    Best Regard

    Yours In Service,

    MEGG Funding Management.

    ReplyDelete
  4. The information which you have provided in this blog is really useful to everyone. Thanks for sharing.
    D365 Finance and Operations Training
    D365 Finance Training
    D365 Operations Training

    ReplyDelete


  5. You can't believe what i just got,… A loan of $ 60,000. I have been looking for a loan for the past 2years until i was referred to a legitimate lender. Though it was not that easy to approve my loan, as you know nothing good comes easy. But I got my loan within 4 hours i got my loan, and before i knew it, the loan was transferred to me. please friends, don't let any body deceive you and scam you for this is real. Contact them via Email: gaincreditloan1@gmail.com OR You can also whatsApp them at: at +1-(901)676-0641 (WhatsApp Only)

    ReplyDelete
  6. I live in the USA Florida and I am a happy woman today? I told myself that any Loan lender that could change my Life and that of my family, i will refer any person that is looking for a loan to Them. If you are in need of loan and you are 100% sure to pay back the loan please contact them and please tell hem that Mrs. WANDA PAULA  refers you to them.  acceptanceloancompany11@gmail.com

    ReplyDelete
  7. I am really happy with your blog because your article is very unique and powerful for new reader.Prefer to study this kind of material. Nicely written information in this post,the quality of content is fine and the conclusion is lovely. Things are very open and intensely clear explanation of issues. PHP Training in Chennai | Certification | Online Training Course | Machine Learning Training in Chennai | Certification | Online Training Course | iOT Training in Chennai | Certification | Online Training Course | Blockchain Training in Chennai | Certification | Online Training Course | Open Stack Training in Chennai |
    Certification | Online Training Course

    ReplyDelete
  8. Hi all, I have seen comments from people who have already received a loan from Anderson Loan Finance. I really thought it was a scam and applied for a loan based on their recommendations because I really needed a loan. A few days ago, I confirmed on my personal bank account the amount of $12,000.00 USD that I had requested for a personal loan with a rental percentage of 2%. This is really good news that I am satisfied with and I advise anyone who needs a real loan and is sure to repay the loan to contact them by e-mail.

    They can lend you any type of loan!
    Please contact Mr. Anderson Ray
    Email: andersonraymondloanfinance@gmail.com
    Phone: +1 315-329-6320
    VAT number EE101252401
    Website:https: //andersonraymondloanfinance.wordpress.com/
    Office address @ (68 Fremont Ave Penrose CO, 81240).

    ReplyDelete
  9. Hello,
    We are a professional Cyber Tech credit team with a large ring around
    the globe infected with more than 3 million debit malware and
    skimmers, we get a blank ATM card and load them with a lot of money
    quickly and safely, with which one can withdraw Cash either in euros or
    Swiss franc from ATMs and can be used by any POS system
    Note: Our cards are Illegal but trust me its 100% safe
    Contact: Kelvin Ericksson
    Email: blankatmmaster5555@gmail.com
    WhatsApp +3197005033695
    web site: http: //blankatmmaster5555.wixsite.com/
    Harkers

    ReplyDelete
  10. WELCOME TO ILLUMINATI BROTHERHOOD ORGANIZATION.
    I believe we all have a dream, a dream to become something big in life, so many people die today without accomplishing their dreams. Some of us are destined to become the president of our various countries or to become. one of the world's greatest musicians, footballers, politicians, businessmen, comedians or to be a helper to other people that are in need Note; newly recruited members are entitled to great benefits and rewards, There is no human sacrifice. If you are truly interested in joining the illuminati contact us today for more Information WhatsApp:+1(234)248-7286 OR +919205107358
    Email: illuminatikingdomempire@gmail.com

    ReplyDelete

  11. Thank you so much for the great Blog.It is very interesting Blog!!
    DevOps Training
    DevOps Online Training

    ReplyDelete
  12. me and my husband are here to testify about how we use Oscar White black ATM card to make money and also have our own business today. Go get your blank ATM card today and be among the lucky ones. This PROGRAMMED blank ATM card is capable of hacking into any ATM machine,anywhere in the world.It has really changed our life for good and now we can say we are rich and we can never be poor again. You can withdraw the maximum of $5,000 daily and $140,000 a month, We can proudly say our business is doing fine and we have up to $20,000 000 (20 millions dollars in our account) Is not illegal,there is no risk of being caught ,because it has been programmed in such a way that it is not traceable,it also has a technique that makes it impossible for the CCTV to detect you..For details and cost on how to get yours today, email the hackers on : oscarwhitehackersworld@gmail.com ,Text & Call or Whats-app: +1(209)-643-1515

    ReplyDelete
  13. Hello!!! Do you want to be a member of the great illuminati and start receiving $50,000,000.00USD , monthly and be popular among others and have riches and fame,,this is the only chance of being of the illuminati..I was sent by the freemason high chief to bring 52 members into the illuminati,I have gotten 32,so we looking for 20,,so try and be among the tweenty people to be rich and famous, WhatsApp Via; +2348119239306, or Email Via : illuminatiofficial466@gmail.com , so we can begin the joining process!!!

    ReplyDelete
  14. I really wish msft had given this option out of the box by now. Using expenditure reviewer is another option however has it's shortcoming especially when we need to switch the employee on the fly for approval of an invoice - this blog of yours will surely help in that case, so thank you!

    ReplyDelete
  15. GOOD DAY AND WELCOME TO ASDA FINANCE LTD®

    We Are Currently Trying To Invest In A Good Profitable Business, Please Present Only Viable Business Ideas. If You Have Projects That Need Financing Kindly Come Back With Your Business Plan.
    If We Find Your Business (Investment) Profitable, Then you Will Be Contacted As Soon As Possible.
    Whatever Your Circumstances are, Self-Employed, Retired, With Poor Credit.
    We Can Help You With Our Flexible Repayment Schedule of about 2.7 to 3.2% interest rate only.
    We Can Also Meet Your Financial Need Without Repayment Problems(1year) after the loan is transferred.
    Please Contact Us:
    asdaservices24@gmail.com
    Thanks And God Blessings.

    ReplyDelete
  16. I want to use this opportunity to thank Mr Charles ANTHONY who finally helped me to become a full member of the Great Illuminati Brotherhood and now i am living my life in happiness. and I was once indigent and live my life in extreme poverty and the standard of living became so poor and low that I even taught of killing myself, and he told me to get ready for my initiation day and that all new members has a certain reward of $ 100000 USD on your initiation day. so i was initiated to the Illuminati world and few days i was awarded a contract worth of Thousands of Dollars, in my business i am doing very well right now, I did exactly what i was ask to do and today the story has change, I am a living testimony, my dream and all the wealth, fame, success and riches, i have ever desired is been made a reality. All the same thanks to Mr Charles Anthony who made my dreams a reality by helping me become a member of the great Illuminati. Hurry up now you can whats-app him on +2348119132137 or email. johndavid2135@gmail.com.,,,,,

    ReplyDelete
  17. The Facebook application has an immense wellbeing wall incorporate into it. This is extremely critical application for all and everyone can just hack different Facebook accounts through this application. Pro Hacker

    ReplyDelete
  18. Norton Internet Security Full Crack offers you with the new and full antivirus wellbeing through remarkable acknowledgment cost. Norton Internet Security Full Crack

    ReplyDelete
  19. Persuasive statements for Sister's Day god slants toward his adolescents inside his own interesting way, and the most brilliant gift he has presented on Maine is you, my dear sister. Happy Sisters Day Quotes Wishes

    ReplyDelete

I will appreciate your comments !

Download large bacpac (sandbox database) to DEV environment much faster

As the LCS website gets slower and slower and the database backups get bigger and bigger.  Use AZCopy to download objects out of LCS asset l...