Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Web part error in Business Portal 5 - BP SDK

(0) ShareShare
ReportReport
Posted on by 3,900

I am creating a web part that uses the Sales Document-Restricted Self data permission to show a list of quotes for the logged on user.  The user ID is set up correctly and assigned to the Customer role.

This is the error I receive:

System.InvalidOperationException
Cannot convert the AssociatedView, SalesDocument, to an EntityAlias because a valid parent key cannot be assigned.

Did a search on CustomerSource and followed KB 935228 to fix.  I still receive this error.

This is Business Portal 5 on Windows Server 2003 R2 x86.

Any other ideas to fix this would be appreciated.

Thanks.

-Joe

*This post is locked for comments

  • Suggested answer
    Chris Roehrich Profile Picture
    Chris Roehrich 289 on at
    Re: Web part error in Business Portal 5 - BP SDK

    Hi Joe,

    I am able to reproduce this issue also.  Once I went into the Site Settings of the new site and set the master page to "Inherit site master page from parent of this site" the web part worked.   I was also able to see the company containment drop down in the navigation menu across the top of the page.   My site happens to run on MOSS which allowed me to do this via the Site Settings interface.   If you are using WSS, you can do the below steps taken from the Business Portal 4.0 Integration Guide:

    Setting a master page with WSS

    The web-based administrative interface for WSS does not provide a way to set the

    master page for a site. To do this, you must use Visual Studio to write and run code

    that accesses the SharePoint API to set the master page properties for the site. The

    following procedure describes this process.

    1. Create a new Visual Studio project.

    A command-line application is adequate for setting WSS properties. This

    example uses a C# project.

    2. Add references to access SharePoint.

    To access the SharePoint API, you must add a reference to the

    Microsoft.SharePoint assembly. In the Project menu, choose Add Reference.

    Choose the Windows® SharePoint® Services assembly and click OK.

    3. Add a using statement.

    To provide convenient access the SharePoint API, add the following using

    statement to your code:

    using Microsoft.SharePoint;

    4. Write the code to update the master page property.

    The MasterUrl property specifies the relative path to the master page that the

    site will use. The following C# code opens the BPSDK sample site and sets the

    to use the BusinessPortalDefault.master master page.

    SPSite website;

    SPWeb webinstance;

    // Open the BPSDK (custom) site

    website = new SPSite("http://gpsdk/BP/BPSDK");

    webinstance = website.OpenWeb();

    // Specify the master page to use for the site

    webinstance.MasterUrl = "/_catalogs/masterpage/

    BusinessPortalDefault.master";

    webinstance.Update();

    5. Build the application.

    From the Build menu, choose to build the solution.

    6. Run the application.

    When you run the application, it will update the master page property for the

    site.

  • Chris Roehrich Profile Picture
    Chris Roehrich 289 on at
    Re: Web part error in Business Portal 5 - BP SDK

    Joe,

    I can test this out sometime today or tomorrow for you but I believe your environment with a SharePoint web part page is what is causing the problem.   One way to test is too simply ceate a custom web part in a BP Web Part page that is in the BP sub site and see if that data permission works correctly.   The KB references a company containment issue and I believe that using just a SharePoint web part page versus the BP web part page is affecting the ability for the web part to use the BP result viewer API and\or company containment features.

    Thanks,

    Chris

  • Joseph Markovich Profile Picture
    Joseph Markovich 3,900 on at
    Re: Web part error in Business Portal 5 - BP SDK

    Hi Chris-

    Thanks for checking out my question.  Here is the KB article:

    mbs.microsoft.com/.../kbdisplay.aspx

    This is just a custom web part I've created that uses the Sales Document-Restricted Self data permission that's built-in to the BP install.

    One thing I was thinking about today was this web part is sitting on a Sharepoint web part page (not a Business Portal web part page) in a new subsite of BP i've created.  In the Admin guide, it says this:

    Create a new center site

    You can create additional subsites of the top level Business Portal site. When you

    create a new Business Portal subsite, you should apply the Business Portal master

    page. A master page contains the page design and layout elements that you want to

    repeat on multiple pages in a site. The Business Portal master page contains the

    company selection list that appears in the upper-right corner of Business Portal

    pages.

    • When you create a new subsite in Office SharePoint Server, you can apply the

    Business Portal master page. Click Site Actions > Site Settings > under Look

    and Feel, click Master page. Under System Master Page, select

    BusinessPortalDefault.master.

    • If you’re using Windows SharePoint Services only, you can’t change the master

    page through site settings. If you want to use the Business Portal master page, a

    developer must apply it using SharePoint application programming interfaces.

    For more information about sites and master pages, see the SharePoint

    documentation.

    We are using WSS 3.0.  Sharepoint errors out if I try to create a new Business Portal web part page on this new subsite, but I can create a standard Sharepoint web part page just fine.  If I go to any of the built-in subsites in the Business Portal install, I can create the Business Portal web part page just fine.

    Is this part of my issues with the web parts erroring out?

    Thanks.

    -Joe

  • Chris Roehrich Profile Picture
    Chris Roehrich 289 on at
    Re: Web part error in Business Portal 5 - BP SDK

    Hi Joe,

    I am unable to find this KB for some reason, do you have a link for me?  Is this related to a custom entity that was created using the BPSDK tool set?  I noticed the title of your issue says BPSDK in it, but this data permission you reference is not a custom data permission, correct?

    You may want to open a support incident for this issue as it might be more helpful to see the issue via screen sharing.  

    Thanks,

    Chris Roehrich

    Developer Support

    Dynamics GP

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,253 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans