My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

24 February 2008

Advanced filtering on a Dynamics AX Web Form published in a SharePoint environment

When you have Enterprise Portal configured within your SharePoint environment, it is possible to open your ERP data from Microsoft Dynamics AX towards every user having access to the SharePoint environment. This can be achieved by making use of Web Forms. Web Forms have no filtering possibilities compared to the regular forms in the Microsoft Dynamics AX client. End-users are only able to sort records displayed in a Web Form.
To enable advanced filtering possibilities on Web Forms, you should do a little coding in your Web Form in the Microsoft Dynamics AX environment and you should create a Web Page to display your Web Form in your SharePoint environment.
The steps to follow in your Microsoft Dynamics AX environment:


  1. Create a New Web Form

  2. Add a Datasource to the Data Sources node of the created Web Form (f.e. CustTable).

  3. Add two WebGroup controls to the Design node of the created Web Form: Filter and Grid.

  4. Add a WebGrid control to the WebGroup control Grid and add some fields of the CustTable Data Source to the WebGrid (f.e. AccountNum, Name, CustGroup and ZipCode). Set the property AllowEdit to No for each field.

  5. Set following properties to following values for the added WebGrid control

    • DataSource: CustTable

    • ShowNavigationButtons: Yes

    • VisibleRows: 25

  6. Add two WebEdit controls to the WebGroup control Filter: call them FilterName and FilterCustGroup. Set the property AutoDeclaration to Yes and the Extended Data Type to Name and CustGroupId.

  7. Add a WebButton control (Submit) to the WebGroup control Filter.

  8. Adapt the classDeclaration of the created Web Form as follows:
    public class FormWebRun extends ObjectRun
    {
    QueryBuildRange NameQBR;
    QueryBuildRange CustGroupQBR;
    Name name;
    CustGroup custGroup;
    #define.Name('WebForm_Name')
    #define.CustGroup('WebForm_CustGroup')
    }

  9. Adapt the init method of the CustTable Data Source as follows:
    public void init()
    {
    super();
    NameQBR = this.query().dataSourceNo(1).addRange(fieldNum(CustTable,Name));
    CustGroupQBR = this.query().dataSourceNo(1).addRange(fieldNum(CustTable,CustGroup));
    }

  10. Adapt the executeQuery method of the CustTable Data Source as follows:
    public void executeQuery()
    {
    ;
    if(name)
    {
    NameQBR.value(name);
    }
    else
    {
    NameQBR.value(FilterName.text());
    name = FilterName.text();
    }
    if(custGroup)
    {
    custGroupQBR.value(custGroup);
    }
    else
    {
    CustGroupQBR.value(FilterCustGroup.text());
    custGroup = FilterCustGroup.text();
    }
    super();
    }

  11. Adapt the clicked method of the Submit Web Button as follows:
    void clicked()
    {
    name = FilterName.text();
    custGroup = FilterCustGroup.text();
    CustTable_ds.executeQuery();
    super();
    }

  12. Adapt the saveViewState method as follows:
    public void saveViewState()
    {
    super();
    if(Name)
    {

    this.viewStateItem(#Name,name);
    }
    if(CustGroup)
    {
    this.viewStateItem(#CustGroup,custGroup);
    }
    }

  13. Adapt the loadViewState method as follows:
    public void loadViewState()
    {
    super();
    if(this.viewStateContains(#Name))
    {
    Name = this.viewStateItem(#Name);
    }
    if(this.viewStateContains(#CustGroup))
    {
    custGroup = this.viewStateItem(#custGroup);
    }
    }

  14. Create a Web Content->Display item for your created Web Form.


So far what is needed in your Microsoft Dynamics AX environment. Your created objects should look like this:

In our SharePoint environment, we need to display the data to our SharePoint end-users. To achieve this, follow these steps:

  1. Create a New Web Part Page.
  2. Add the Web Form Web Part to the page.
  3. Click Modify Shared Web Part.
  4. In the Dynamics Properties part, choose the menu item previously created in the WebDisplayContentItemName dropdown box.



Your SharePoint end-users are now able to use advanced filtering (wildcard filters, ...) on the Name and CustGroup field of the CustTable just like the Dynamics AX end-users can in the Microsoft Dynamics AX Client. By clicking the Submit button, the records in the CustTable Web Form are filtered, taking into account the filter values entered in the WebGroup Filter control.


Continue reading......

by Patrik Luca 3 comments

16 February 2008

All sites search scope missing in the search box for non-English created sites

Sites created in a non-English language are missing the All sites and All people search scope in the search box in the upper right corner of each page. Only the This site: search scope appears in the drop down box.

To fix this, follow these steps (the example is for a site created in Dutch):

  1. Go to the Site Collection level and choose Site Actions -> Site Settings -> Modify All Site Settings.
  2. Click Search Scopes under the group Site Collection Administration.
  3. Click New Display Group.
  4. The title you enter is very important. For Dutch sites it needs to be exactly the text Vervolgkeuzelijst voor zoeken and nothing else. For other languages you'll need to find the exact translation in your language of the English default equivalent Search Dropdown.
  5. At the Scopes group click both People and All Sites.
  6. At the Default Scope group, click All sites.

You can rename at the SSP level the All Sites and People in your own language to have a consistent language interface for your end-users.


Continue reading......

by Patrik Luca 14 comments

03 February 2008

Sign in as Different User returns to portal home page

If multiple users are using the same client PC, you can run into following issue: when a new user logs in using the Sign in as Different User function, the user receives the error Access Denied. This error is thrown because the user is redirected by the Sign in as Different User function to the page which was last opened by the previous user and the new user doesn't has rights on this page. This can be confusing for end-users.

You can adapt the INIT.JS file in the 12\TEMPLATE\LAYOUTS\<lcid> hive as such that upon execution of the Sign in as Different User function, the page being displayed is the home page of the portal.

Look for the LoginAsAnother function in the INIT.JS file and adapt it as follows:

function LoginAsAnother(url, bUseSource){
document.cookie="loginAsDifferentAttemptCount=0";
if (bUseSource=="1") {
GoToPage(url);
}
else {
var ch=url.indexOf("?") >=0 ? "&" : "?";
// url+=ch+"Source="+escapeProperly(window.location.href);
url+=ch+"Source=/default.aspx";
}
}


Continue reading......

by Patrik Luca 0 comments

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links