Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 18, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Insert Opportunity question
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Apr 09 6:41 PM
On the insert opp screen, when a user adds a product on insert, I need to access the accountid from the top portion of the insert opp screen on the insert opp product screen launched from the plus button (add opportunity product) on the insert opp screen. Is there a way to get the accountid on the insert opp product screen?
[Reply][Quote]
Jason
Posts: 16
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 9:15 AM
One way that we have gotten around similar scenarios is by putting a hidden field on the screen containing the ID (you would derive it from lveAccount). This is a very common solution for us to have IDs not inherently available on the form.
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 9:24 AM
How would I get the value from the lveAccount on insert opp screen to the Add opp product screen? This is my disconnect..
[Reply][Quote]
Jason
Posts: 16
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 9:40 AM
Ahh - I see...you haven't actually written anything to the DB yet. Unfortunately I don't have an answer for you. In our industry we've had to scrap nearly the entire Opportunity process (since we don't actually selling anything) and design our own...including a new Insert Opportunity screen.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 1:07 PM
Hi Steve,

Take a look at this blog post: http://customerfx.com/pages/crmdeveloper/2009/04/08/accessing-the-current-parent-entity-from-a-code-snippet-action.aspx?CommentPosted=true

It outlines how to get the current parent from a child dialog.

-Ryan
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 1:48 PM
Thanks Ryan.. I am still not quite out of the woods.. so this is the magic:
IMyParentEntity myparent = form.WorkItem.Services.Get().GetEntity() as IMyParentEntity;

In the context of the Insert Opp Product smartpart, how would I get the accountid from the lueAccount on the insert opp form?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 1:58 PM
First of all, I am assuming that this is in a Code Snippet Action.

Basically you'd do something like this and it would likely work just fine (not tested or anything)

// get the current opp bound to the Insert page
IOpportunity opportunity = form.WorkItem.Services.Get().GetEntity() as IOpportunity;

// now you can reference the account linked to the opp (that was selected in the lookup)
IAccount account = opportunity.Account;
form.labelControl.Text = account.Id.ToString(); // etc


Does that make sense?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 2:07 PM
Also, to point out Steve,

The "how" all goes back to what the entity is for the form itself. Thinking about your situation a bit (I don't have a SLX system where I am at), the form you're doing this on is probably already an opp form. If that is the case there is no need to get the parent, but just the current entity:

IOpportunity opp = form.CurrentEntity as IOpportunity;
string accid = opp.Account.Id.ToString();


The point is, once you get a reference to the opp entity itself, you just access the selected account from the Account relationship property. That should work fine.

-Ryan
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 4:24 PM
Ryan, the add opp product screen ships as a custom screen found under suppport files - so I am not calling from a Code Snippet Acction - I am trying to put the code in the addopportunityproduct.ascx.cs.

The first place I tried it is in the pageload event. On this line:
IOpportunity oppo = form.WorkItem.Services.Get().GetEntity() as IOpportunity;

I get the error:
Error 40 The name 'form' does not exist in the current context

I am assuming it is because it is not in a Code Snippet Action.. any thoughts?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 4:55 PM
Ah. That is right. In that case you will use:

Sage.Entity.Interfaces.IOpportunity opp = this.GetParentEntity() as Sage.Entity.Interfaces.IOpportunity;
// opp.Account;
[Reply][Quote]
Steve Knowles
Posts: 657
Top 10 forum poster: 657 posts
 
Re: Insert Opportunity questionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 08 Apr 09 7:14 PM
Got it. Thanks! It bombed in the onload event but is working like a charm in the Prerender event. thanks for the explaination Ryan. I am going to take a stab at a similar operation in a code snip actions so your previous explaination won't go to waste.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/18/2025 10:43:14 PM