Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, July 6, 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: New to development. have simple request regarding external assemblies and referencing smartparts.
Ali Youssefi
Posts: 18
 
New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 10:49 AM
Hi everyone,
I have been searching this site and couple others by Ryan. Anyway I am new to the Sage environment and am customizing a solution in 7.5.
I have created smartparts for an entity, in this case AccountMailings.
My problem is that I need to check/uncheck some checkboxes from a calculated field on the AccountDetails form.
To accomplish this task I need to create an external assembly and use business rules.
I think I have all my references and have included the line inherits EntityBoundSmartPartInfoProvider.
So I created a business rule and have found out that the parameter for the method must be the same Interface, in this case IAccount instead of IAccountMailings.
I need to be able to hit the AccountMailings controls and have searched to no avail.
The closest I seem to get is this:
Dim accountmailings As IAccountMailings = EntityFactory.GetRepository(Of IAccountMailings)().[Get](form.Id.ToString)
or maybe this:
Dim temp As Sage.Form.Interfaces.IAccountMailings = EntityFactory.GetRepository(Of IAccountMailings)().FindByProperty("AccountId", form.Id.ToString)

I hope someone might be able to help me out or maybe point me in a direction where I can read up on a solution.
Any and all help is greatly appreciated!
Thank you.
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 1:38 PM
Ali, I think you are on the right track. However in general I set the value in the entity, rather than on the control directly (when you set them on the controls they tend to get overwritten by the databinding). So you don't need to get a reference to the form. In your business rule you will get a reference to the entity (if it is an account form, you will get a reference to the account entity, but from there you can traverse to related entities).

It sounds like you have a button on the Account Detail form that when clicked will invoke a business rule that should check/uncheck some boxes on all related mailings records... is that correct?
[Reply][Quote]
Ali Youssefi
Posts: 18
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 1:48 PM
Nicolas,
Thank you for the reply! I guess a better description of my problem is needed:
For the Account entity, i have various smartparts/tabs("tab") that need to have custom code for each "tab"...
For instance, I have a tab that has two picklists. One is populated from the Picklist Name property. The other has the Picklist Name property filled in for the sake of the page not bombing, but I will overwrite this.
So say the first picklist, choice A is chosen, I need the second picklist to be the subtypes of choice A. So on and so forth for B, C, n
My thing is, if I did this via a code snippet it seems to run fine, HOWEVER when I use an external assembly I must reference the IAccount interface in the parameter for the function. \
I cannot use IAccountTab.
So I do have at my disposal the id for the Account from the interface but I don't have control of the controls on the various tabs or even the Account Detail page. The only thing I can do is write to the Properties of the Account Entity.
The error occurs when I create a new function for the picklist tab. If I try to use IAccountTab it will not work saying IAccount and IAccountTab are two different types...this is the typical ASP.NET error screen.
So the only way I have got these business rules to work is by using the IAccount tab but now I have no idea how to tie an instance of the IAccountTab interface to the correct record.....

Thanks again for any and all help!
Thank you.
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 3:56 PM
OK, I think I get it. In order to get access to the controls you will have to define it as a snippet, not a business rule. You can have your snippets actually be implemented in an external assembly. So basically you have a number of approaches to get code to run... they all achieve some slightly different results:
* C# Snippet action items are the simplest, in this case the code just gets inlined into the form. Unfortunately with that simplicity comes a cost and you lose any form of compile-time validation.
* Business Rules are the next ones. You can only set properties from the entity there, so they are of limited use for any interface interaction.
* Code snippets (different from C# snippet action) receive a "Form Adapter" parameter - this gives you access to the controls. These can be implemented either as actual snippets (although there have been reports that this is a bit buggy) or associated with a method in an external assembly (in which case you have to declare your method to match that of the snippet, eg something like OnPicklistChange(IAccountTabForm form)). Then you can do form.pklSubType.PickListName = ... You get compile-time checking but the implementation appears to be a bit buggy at the moment.
* Custom smart part, in which case you do what you want - in my opinion this is often the easiest in the long run if you are reasonably familiar with ASP.NET and have non-trivial logic to implement
[Reply][Quote]
Ali Youssefi
Posts: 18
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 4:30 PM
Nicolas,
Thank you very much for this information!
After talking with my team we will go with either one of the snippets.
The reason we had originally went the route of external assembly was due to the fact that the snippet action embeds the code in many places.
Can you give me a reference on how to call the method within my external assembly. I guess I'm still a bit confused about how the method in the snippet will reference the assembly. Do I just need to create a new instance of the assembly?
Which one of these is a best practice?
Thanks again!
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 May 09 4:52 PM
Yes, I am totally with you on the external assemblies - using snippets makes it a nightmare to find out what is going on because your code is scattered all over the place. It reminds me of development on Saleslogix 5.2 - ugh.
To be honest I now only use custom smart parts in any cases where I need any form of logic. They are just so much easier to troubleshoot. However here is how you would do it on a quickform (say, if you want a handler on the picklist change event):
* go to the OnChange Action, go under Action Name and click the ellipsis
* go to Code Snippet Action Item
* click on Method... this will prompt you for the method name
* under Steps click "Add". Click on "C# Code Snippet" and make note of the signature (do not click OK yet).
* Add the method, matching the signature shown, to your external assembly
* back on the dialog, click on "External Assembly" and select your method
* click OK, OK, build and deploy, copy your external assembly to the bin folder, and you are set

I am not sure which one is the best practice - if you look at the existing Sage forms they use all 4 methods.
[Reply][Quote]
Ali Youssefi
Posts: 18
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 09 9:47 AM
Hi Nicolas,
I have tried your code snippet technique and it works great! Thank you again for the help!
One thing I have noticed however is the fact that if a control is binded to a property, it will not write data to it...only if the data has been changed.
Here's an example:
I have a textbox that is bound to a property (City). It has the text 'New York' in it. If I check a checkbox on the same form, it fires an onChange method that will update the text in the textbox to 'Atlanta'.
If the textbox is not bound, this will work fine.
If the textbox is bound, 'New York' will not be overwritten.
If the textbox is bound AND the textbox text has changed to say 'New York2', the method will successfully write 'Atlanta'.

This makes me think it might have something to do with ViewState. Anyway, I was wondering if you have seen this issue before.
Thank you again for your help!
[Reply][Quote]
Ali Youssefi
Posts: 18
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 09 10:10 AM
Nicolas,
I have found a fix to my example but am not sure the ramifications just yet. I basically just added the enableviewstate=false property to the pages node of the config file and it seems to work. However, I know this will affect all pages. I was wondering if you have seen this done before. I am kind of hesitant to modify the config file but will keep testing to see if I come up with any issues due to the viewstate being turned off.
Thank you for your help.
Ali
[Reply][Quote]
Nicolas Galler
Posts: 93
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 May 09 12:27 PM
Would be very curious to know if it works - it seems I had some problems with the events firing inappropriately when I tried disabling it, but that was some time ago.

I had some problems with the Change events as well. I think the issue comes from the way the databinding is implemented. From your checkbox, are you populating the entity's property, or the textbox.Text directly, or both? If you are populating the textbox directly, try populating the entity property instead as this is usually the most reliable way. However this means that if they change the textbox text (e.g. to New York 2) your code will not take effect and it will keep New York 2. So you may have to populate both the textbox and the entity's property.
[Reply][Quote]
Ali Youssefi
Posts: 18
 
Re: New to development. have simple request regarding external assemblies and referencing smartparts.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 May 09 9:12 AM
Hi Nicolas,
I tried your approach of updating the property for the entity and this seems to achieve the same result as disabling the viewstate. Since I'm not too familiar with all aspects of the portal just yet, I am hesistant to modify something globally (web.config). Your approach works and reflects exactly what I need. I have reverted the config file to the original version.
I consider this issue closed and again thank you for your support with my issue.
Thank you.
Ali
[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): 7/6/2025 7:28:16 AM