Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

How to add Hyperlink to the field in grid

Posted on by Microsoft Employee

Hi

I have custom field in grid, the field is sales order Id.

Now I need to provide the hyperlink to that field and when user clicked on this it has to open sales order form with selected sales order Id.

Kindly assist if any knows how to achieve this.

Thanks 

Haribabu

  • Kannan01 Profile Picture
    Kannan01 65 on at
    RE: How to add Hyperlink to the field in grid

    Hi,

    1. If you set your "Form Template" (which is under Form properties) as List Page and when you drag and drop fields from DS, you will get Hyperlink DataSource and Hyperlink Menu Item under Grid level field properties. Refer SalesTableListPage form in D365 F&O

    2. Create Menu item button in Action Pane and set Visible as No (Refer ViewButton in SalesTableListPage Form)

    3. In your Grid (under properties), set Default Action as View Button.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add Hyperlink to the field in grid

    Thank you very much Raja

  • Verified answer
    RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: How to add Hyperlink to the field in grid

    above code delete your listpage level jumpref override method now  then-->

    Class name  -->ReqTransPOListPageInteraction

    ------------------------------------------------------

    Class declaration //

    add variable declaration -->  FormStringControl purchidCtrl;

    --------------------------------------------

    Select --> initialized method

    add the line --> this.hyperinitialized();

    ----------------------------------

    add new method --> hyperinitialized

    public void hyperinitialized()

    {

      Array fields;

      FormStringControl ctrl;

      FormDataSource      frmDs;

      Common              currentRecord;

      FormRun             formRun;

      super();    

      currentRecord= this.listPage().activeRecord('[Yourdatasourcename]');

      frmDs   = currentRecord.dataSource();

      formRun = frmDs.formRun();

      purchidCtrl = formRun.control(formRun.controlId("Yourfiledname"));

      purchidCtrl.registerOverrideMethod(methodStr(FormStringControl, jumpRef), methodStr(ReqTransPOListPageInteraction, CustomjumpRef), this);

    }

    -----------------------------------------------------------------------

    Add new method   --->CustomjumpRef

    private void CustomjumpRef(FormControl _formControl)

    {

      Yourtable(newfieldaddedtable)       purch;

      Args            args;

      MenuFunction    menuFunction;

      ;

      if (Yourfieldname.valueStr() != "")

      {            

          menuFunction = new MenuFunction(menuitemDisplayStr("Yourhyperlinkformname"), MenuItemType::Display);

          args = new Args(menuFunction.object());

          purch = PurchTable::find(Yourfieldname.valueStr());        

          if (purch.RecId != 0)

          {            

              args.record(purch);

              menuFunction.run(args);

          }

          else

          {

              error(strFmt("Purchase order: %1 no longer exists"));

          }

      }

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add Hyperlink to the field in grid

    In which method can I add code?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add Hyperlink to the field in grid

       Args                        locArgs = new Args();

       SalesTable                  salestable;

       locArgs.caller(this);

      salestable = SalesTable::find(ReqPO.PeggingId);

       locArgs.record(salestable);

       locArgs.lookupRecord(salestable);

        new MenuFunction(menuitemDisplayStr(SalesTable), MenuItemType::Display).run(locArgs);

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: How to add Hyperlink to the field in grid

    ReqTransPOListPageInteraction   class name add above code it will work man...

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: How to add Hyperlink to the field in grid

    Listpageinteraction class -->use this methods...

    //declare in classDeclaration

    FormStringControl purchidCtrl;

    public void initialized()

    {

       Array fields;

       FormStringControl ctrl;

       FormDataSource      frmDs;

       Common              currentRecord;

       FormRun             formRun;

       super();    

       currentRecord= this.listPage().activeRecord('[MyDataSourceName]');

       frmDs   = currentRecord.dataSource();

       formRun = frmDs.formRun();

       purchidCtrl = formRun.control(formRun.controlId("purchId"));

       purchidCtrl.registerOverrideMethod(methodStr(FormStringControl, jumpRef),    methodStr([MyListPageInteractionClass], jumpRefPurch), this);

    }

    private void jumpRefPurch(FormControl _formControl)

    {

       PurchTable purch;

       Args            args;

       MenuFunction    menuFunction;

       ;

       if (purchid.valueStr() != "")

       {            

           menuFunction = new MenuFunction(menuitemDisplayStr("PurchTable"), MenuItemType::Display);

           args = new Args(menuFunction.object());

           purch = PurchTable::find(purchid.valueStr());        

           if (purch.RecId != 0)

           {            

               args.record(purch);

               menuFunction.run(args);

           }

           else

           {

               error(strFmt("Purchase order: %1 no longer exists"));

           }

       }

    }

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: How to add Hyperlink to the field in grid

    Hi Hari,

    Send me you code please.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to add Hyperlink to the field in grid

    Hi Raja,

    Thanks for you reply by doing above I could provide the view details option.and still not able to provide hyperlink to field which is preview pane of list page.

    Could you please suggest.

    Thanks

    Hari

  • RaviRaj Profile Picture
    RaviRaj 530 on at
    RE: How to add Hyperlink to the field in grid

    Hi Hari,

    Select the custom field and go to the properties -->

    Display target default value-->Auto

    Change the value --->Client

    Now use the jumpref override method

    public void jumpRef()

    {

    Args            args;

    MenuFunction    menuFunction;

    ;

    args = new Args();

    menuFunction = new MenuFunction(menuitemDisplayStr(“FormName”), MenuItemType::Display);

    args = new Args(menuFunction.object());

    args.caller(element);

    args.record(“RecordName”); // to be a datasource which added in the current form

    menuFunction.run(args);

    }

    it will work....

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans