Showing posts with label Open table browser. Show all posts
Showing posts with label Open table browser. Show all posts

Thursday, March 16, 2023

Open table browser using x++

 Open table browser using x++.


If we want to open the table browser we need to open visual studio, right-click on the table and select the option like the below screenshot.




My functional required one form and in that he expected one field. That field lookup contains all table lists.


So I have created one form and added a field and button.



Lookup method:

    public void lookup()
    {
	Query                   query;
	QueryBuildDataSource    qbds;
	SysTableLookup          lookup;
	
	super();

	query 	= new Query();
	qbds 	= query.addDataSource(tableNum(SqlDictionary));
	lookup 	= SysTableLookup::newParameters(tableNum(SqlDictionary), this);
	
	qbds.clearRanges();
	qbds.addRange(fieldNum(SqlDictionary, fieldId)).value('0');
	
	lookup.addLookupfield(fieldNum(SqlDictionary, Name));
	lookup.addLookupfield(fieldNum(SqlDictionary, SqlName));
	lookup.parmQuery(query);
	lookup.performFormLookup();
    }


Clicked method:

    public void clicked()
    {           
	SysTableBrowser sysTableBrowser;            

	str tName;

	super();
	
	tName = TableName.valueStr();
	
	if (!tName)
	{
	    throw error(strfmt("@ApplicationFoundation:SysTableBrowser_MissingTableName"));
	}

	sysTableBrowser = new SysTableBrowser();
	sysTableBrowser.parmTableName(tName);
	sysTableBrowser.run(tablename2id(tName));
    }

Keep Daxing!!









Sunday, May 22, 2022

Get Application Environment link IN D365FO

 I got a requirement to get the current application environment and I need to pass to some other integration. Just check the below code.


public static void getEnvironmentAddr() {    
    var env;

    env = Microsoft.Dynamics.ApplicationPlatform.Environment.EnvironmentFactory::GetApplicationEnvironment();

    Info(strFmt("%1", env.Infrastructure.FullyQualifiedDomainName));               

Info(strFmt("%1", env.Infrastructure.HostUrl));// with https

}

Keep daxing!!

Open table browser in D365FO

If we want to run the class or open the table browser from UI we need the link. Please check the below links.


 Run the class from UI:

    Url/?mi=SysClassRunner&prt=initial&debug=vs%2CconfirmExit
            &cls='RunnableClass or class name'&cmp=USMF

    URL : https://'System link'.axcloud.dynamics.com


 Open table browser from UI:
    URL/?mi=SysTableBrowser&prt=initial&limitednav=true
        &TableName="table name"&cmp=usmf




Keep daxing!!