Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, June 29, 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: Updating a date field based on another date field
Kevin
Posts: 20
 
Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 10 1:19 PM

v7.5.3 Web --


 


Have a custom tab with a date field on it that needs to be 5 days greater than the EstimatedClose date if the opportunity is still open, or 5 days greater than the ActualClose date if opportunity is closed.  When I add the code below to the load action for the form, it errors out and won't load, but I can't get any sort of error message to show me what isn't working correctly.


 


 


<p>Sage.Entity.Interfaces.IOpportunity objOpp1 = Bindingsource.Current as Sage.Entity.Interfaces.IOpportunity;


DateTime EstDate = new DateTime();

DateTime ActClose = new DateTime();

EstDate = objOpp1.EstimatedClose;

ActClose = objOpp1.ActualClose;

 

if (objOpp1.Closed == "T")

{

objOpp1.GoLiveDate = EstDate.AddDays(5);

}

Else 

{

if (objOpp1.GoLiveDate == null || objOpp1.GoLiveDate < ActClose.AddDays(5))

{

objOpp1.GoLiveDate = ActClose.AddDays(5);

}

}


 

[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 10 1:35 PM

Your code is assuming that the Estimated and Actual Close dates are not NULL, I would suggest you check them first.


 

[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 10 1:51 PM

In addition to what Raul said, if those are nullable values you can use stuff like if objOpp1.EstDate.HasValue, etc


BTW, what is the error message you are getting?

[Reply][Quote]
Kevin
Posts: 20
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 10 5:00 PM
fiogf49gjkf0d

Thanks for the reply.  I checked for the nulls which is an obvious miss on my part an still having problems.



My biggest frustration is that I can't get an error message to display.  All I get is a blank page.  I see the gradient image, but no text/controls/menus, etc show up on the page and no error message.


 


Here's my code now: 


Sage.Entity.Interfaces.IOpportunity objOpp1 = BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;


 


DateTime EstDate = new DateTime();



if (objOpp1.EstimatedClose.HasValue)

{

EstDate = Convert.ToDateTime(objOpp1.EstimatedClose);

}

else

{

EstDate = DateTime.Now;

}

DateTime ActClose = new DateTime();

ActClose = Convert.ToDateTime(objOpp1.ActualClose);

if (objOpp1.ActualClose.HasValue)

{

ActClose = Convert.ToDateTime(objOpp1.ActualClose);

}

else

{

ActClose = DateTime.Now;

}

if (objOpp1.Closed == 'T')

{

objOpp1.GoLiveDate = tempDate.AddDays(5);

}

else

{

if (objOpp1.GoLiveDate == null || objOpp1.GoLiveDate < ActClose.AddDays(5))

{

objOpp1.GoLiveDate = ActClose.AddDays(5);

}

}


 


[Reply][Quote]
Kevin
Posts: 20
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 10 5:06 PM
fiogf49gjkf0d

Actually, line 21 should read "objOpp1.GoLiveDate = EstDate.AddDays(5);

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Nov 10 3:30 AM
fiogf49gjkf0d

Presumably you've tried forcing this into a debugging session, ie (effectively) putting a 'stop' near the beginning of your code?

[Reply][Quote]
Kevin
Posts: 20
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Nov 10 7:48 AM

So, Here's the final, working code.  Key difference was how I was addressing the "Closed" field in the Opportunity.  I was looking for the text value "T", where the AA wanted me to use the logical value of "true".  Condensed the code a bit, but now works as expected.



thanks for the help.


 



Sage.Entity.Interfaces.IOpportunity objOpp1=BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;
DateTime tempDate=new DateTime();
tempDate = Convert.ToDateTime(objOpp1.EstimatedClose);

DateTime ActClose=new DateTime();
ActClose = Convert.ToDateTime(objOpp1.ActualClose);

if (objOpp1.Closed!=true)
{
    objOpp1.GoLiveDate=tempDate.AddDays(5);
}
else
{
     if(objOpp1.GoLiveDate==null || objOpp1.GoLiveDate<ActClose.AddDays(5))
    {
        objOpp1.GoLiveDate=ActClose.AddDays(5);
    }
}

[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Nov 10 8:12 AM

Nice one, well done.

[Reply][Quote]
Mike LaSpina
Posts: 116
 
Re: Updating a date field based on another date fieldYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 09 Nov 10 12:55 PM

Another option that I always use is the GetValueOrDefault to ensure the date is not null for example:


 


   objOpp1.ActualClose = objOpp1.ActualClose.GetValueOrDefault(SystemDateTime.UtcNow);


   objOpp1.GoLiveDate = objOpp1.ActualClose.GetValueOrDefault(SystemDateTime.UtcNow).AddDays(5);

[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): 6/29/2025 1:48:50 PM