Friday, July 27, 2018

Metadata Lookup - list of forms in D365

Here I am explaining how to write a lookup to get a list of forms and same way we can write a lookup of any metadata lookups.

In AX 2012 we have a table called 'UtilElements' to get the list of objects and then you can filter with 'UtilElementType' in your query.

In 365, they have introduced an API instead to get the list of metaData based on your requirements.

var    forms = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::FormNames();

So for lookup, I have developed a tmp table and that has two columns
1. FormName
2. FormLabel

And that table will get inserted when you open the form where we have a requirement to put the lookup. 
*******************************************************
   SysFormsListTmp    formsList;
    
    public void populateFormsListTmp() // custom method to populate the tmp table
    {
       
        var                     forms = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::FormNames();

        ttsbegin;
        while (forms.MoveNext())
        {
            formsList.clear();
            formsList.FormName = forms.Current;
            formsList.FormLabel = formName2Pname(formsList.FormName);
            formsList.insert();
        }
        ttscommit;

    }

    
    public void init()  //init() method of the form.
    {
        super();
        element.populateFormsListTmp();
    }
******************************************************
And then you can write a lookup() method on your control.

******************************************************
public void lookup(FormControl _formControl, str _filterStr)
{
                
                SysTableLookup sysTableLookup = SysTableLookup::newParameters(Tablenum(SysListOfFormsTmp),_formControl);
                Query query = new Query();
                QueryBuildDataSource queryBuildDataSource;
                
                
                sysTableLookup.addLookupField(fieldNum(SysFormsListTmp, FormName));
                sysTableLookup.addLookupfield(fieldNum(SysFormsListTmp, FormLabel));

                queryBuildDataSource = query.addDataSource(tableNum(SysFormsListTmp));
                queryBuildDataSource.addSortField(fieldNum(SysFormsListTmp, FormName), SortOrder::Ascending);

                sysTableLookup.parmQuery(query);
                sysTableLookup.parmTmpBuffer(formsList);

                sysTableLookup.performFormLookup();

                super(_formControl, _filterStr);
                
    }

Tags: #FormLookup #MetaData #D365FO 

19 comments:

  1. I have a fondness for your post. I think that you are very smart and knowledgeable. Your articles contain so much insight and information. They help me when I need to solve problems. Thank you for sharing what you know. Đăng ký B30 của VinaPhone Gói MAXSV2 vinaphonevn , Gói cước VD300 của VinaPhone

    ReplyDelete
  2. Water is the source of life, without water we will hardly live, study and work. However, with the rapid development of the industry, water has been contaminated with toxic substances, causing many serious illnesses, threatening human health and life. How can we protect our health and our loved ones?
    gái gọi, gai goi ha noi, gai goi sinh vien, gái gọi Phố Cổ - Quán Sứ

    ReplyDelete
  3. I think I should also work hard for my own website like I see some good and updated working in your site Thanks for sharing this Informative content. Well explained. Got to learn new things from your Blog on Create Discount master
    Product discount app

    ReplyDelete
  4. Whoever reads the article will want to express his thoughts, I think it is really cool and new to me, maybe I should take the time to learn about it.
    https://autoketing.com/project/sale-pop-master, https://apps.shopify.com/sales-pop-master, app autoketing

    ReplyDelete
  5. This post really attracts me from the first minute I know it, share it extensively so that more people know it, I think it is very necessary for all of us, thanks for reading it. this comment of mine.
    Free shipping bar, App Shipping Bar Master, autoketing

    ReplyDelete
  6. Oak is a common household textural product used in western countries with good resistance to termites as well as high durability and fine lines. It brings elegance and elegance to any oak cabinets. The nature of the oak is white and is a high-grade wood with many outstanding features and lines are extremely elegant to create warm space in winter and cool in summer.
    Gái gọi Nguyễn Trãi, Gái gọi Nguyễn Chí Thanh, anh sex, Gái gọi Kim Liên mới, Gái gọi Gia Lâm - Long Biên

    ReplyDelete
  7. This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks
    live chat on facebook, facebook chat login, best autoketing

    ReplyDelete
  8. Thanks! This post is very useful.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete


  10. play food games
    basketball game
    soccer free games
    I admire the person who wrote this post, you are so talented, hope you will promote them and become more successful. I do not feel sorry for taking the time to read this post, it is really nice and useful to me, thanks for posting it.

    ReplyDelete
  11. Thank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read 2player kids
    friv4school 2019
    jogos io 2019

    ReplyDelete
  12. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
    friv 2020
    abcya xyz
    friv 4 online

    ReplyDelete
  13. I was diagnosed as HEPATITIS B carrier in 2013 with fibrosis of the
    liver already present. I started on antiviral medications which
    reduced the viral load initially. After a couple of years the virus
    became resistant. I started on HEPATITIS B Herbal treatment from
    ULTIMATE LIFE CLINIC (www.ultimatelifeclinic.com) in March, 2020. Their
    treatment totally reversed the virus. I did another blood test after
    the 6 months long treatment and tested negative to the virus. Amazing
    treatment! This treatment is a breakthrough for all HBV carriers.

    ReplyDelete
  14. My name is Olisa Blessing, I am so happy. I never believe I will be this happy again in life. I have worked as an air hostess ( cabin crew ) for 3years but early this year, I lost my job because of this deadly disease called Herpes virus (HSV). I never felt sick or notice any symptoms. Not until the day all workers were asked to bring their doctors report card, that was how I got tested and I found out that I'm HSV positive and that made me lose my job because it was considered as an STD and is an incurable disease. I was so depressed that I started thinking of suicide.
    I explained my situation to an older friend of mine, who often said to me 'a problem shared is a problem half solved. She felt so pity for me that she referred me to Dr. Utu Herbal Cure, that was how I contacted Dr. Utu and got the medication from him and was cured for real.
    I went back to my work a month later with another HSV negative test result and they carried out another test to be very sure and they found out I am herpes negative.
    Finally, the initial result was replaced with the new HSV negative test results and my position was reclaimed back to me with an apology letter and a salary increase.
    Beware of impersonators,
    Dr. Utu can only be reached at:
    drutuherbalcure@gmail.com.

    ReplyDelete
  15. I’d recommend using Dr. Utu Herbal Cure topically for instant pain and itch relief as well as accelerated healing of lesions and permanently stopping oral and genital herpes virus outbreaks. I have tried just about everything from acyclovir suppressive therapy to different natural oils, extracts, and other natural methods, some of which are EXTREMELY painful and exacerbate the problem (i.e. apple cider vinegar!). While vitamin E oil and suppressive therapy worked well for me, when I became pregnant I went back to trying to find a herbal cure. I was using vitamin E oil topically for a while but it was thin and difficult to use and only seemed to prevent further outbreaks rather than getting rid of it. I contacted Dr. Utu Herbal Cure through my friend. To my surprise, I could tell my outbreak was starting to heal within only a few hours! No more itching or pain! Dr. Utu Herbal Cure that I used was liquid herbs in bottles, so it was very easy to use. It simply whiffs, but it works so I don’t care! The best part is I successfully delivered a herpes-free beautiful daughter without further medication. Anyone who’s tried Dr. Utu Herbal Cure knows just how quickly those treatments can add up. So give it a go! Anyone can reach Dr. Utu through drutuherbalcure@gmail.com
    +2349072733661

    ReplyDelete
  16. I have had morning, uncontrollable, diarrhea And Diabetes for almost a year now. Within 5-7 minutes after I wake up every morning, I have to hurry to the bathroom before all hell breaks loose. I try to get a cup of coffee before I head in, but sometimes 10 seconds can mean the difference whether I make it or not. I can only describe it as pouring mud out of a shovel. I can't stop it. Having had a colonoscopy, the doctor says nothing is wrong. He wouldn't say that if he were in my pants. Hinted at i.b.s. and prescribed Bentyl 3 times a day, due to anxiety, being an ongoing disorder I've had for years. No help,until i got to the internet for help and i found a testimony of Lewis Hall sharing testimony of how he was cured of this virus by a herbal doctor called Dr.successful and he left his web address so i clicked on the website and Dm him for help too, behold he show me love and share my pain with by giving me the herbal medicine which i make you of he gave me step by instructions on how to apply it, when i
    applied it as instructed i was totally cured of this deadly and shameful disease within
    three days of usage, words are not enough to thank you dr Dm https://web.facebook.com/Drsuccessful-109263294750359 He you can as well dm him on https://www.facebook.com/Priestsuccessful or https://wa.me/qr/UFTMANFGSLY4E1 you can also talk with him on drsuccesfulcuringhome@gmail.com I own you in return.

    ReplyDelete