cancel
Showing results for 
Search instead for 
Did you mean: 

Row order in Form Settings

Former Member
0 Kudos

Hi,

I want from code to do in my form row ordering like is it working on Form Settings.

To do that you have to open form settings of any form. On table format pane you have rows which can be manually ordered. You have to hold left mouse button on a row and then you can reorder rows with your persolized requirement.

Below is link to film which present what I want to accomplish.

Link to film of row ordering

Any suggenstions?

Kind Regards

Sebastian

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185682
Active Contributor

Hi Sebastian,

If you are familiarize with SAP Business One SDK, you can achieve this purpose with the FormPreferencesService object.

A sample:

	SAPbobsCOM.CompanyService oCmpSrv = oCompany.GetCompanyService();
	FormPreferencesService oFormPreferencesService = oCmpSrv.GetBusinessService(ServiceTypes.FormPreferencesService);
	ColumnsPreferencesParams oColPreferencesParams = oFormPreferencesService.GetDataInterface(FormPreferencesServiceDataInterfaces.fpsdiColumnsPreferencesParams);
	//form type 
	oColPreferencesParams.FormID = formType;
	//user id (e.g manager= 1)
	oColPreferencesParams.User = userID;
	//get columns preferences 
	ColumnsPreferences oColsPreferences = oFormPreferencesService.GetColumnsPreferences(oColPreferencesParams);


	//walk the among the columns
	for (int j = 0; j <= oColsPreferences.Count - 1; j++)
	{
		
		//Find the column that you want - In this sample I want the column Item Number("1") from item content matrix ("38") on sales order form("139")
		if (oColsPreferences.Item(j).Column == "1" && oColsPreferences.Item(j).ItemNumber == "38") //Find the column that you want - In this sample
		{
			//Update de position of the "Item Number" column
			oColsPreferences.Item(j).TabsLayout = 2;
		}
	}
	//Then, commit the changes.
	oFormPreferencesService.UpdateColumnsPreferences(oColPreferencesParams, oColsPreferences);

Hope it helps.

Kind Regards,

Diego Lother