mibuso.com

Microsoft Business Solutions online community
It is currently Wed Apr 16, 2014 3:12 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 5:35 pm 
Offline

Joined: Mon Oct 10, 2011 9:50 am
Posts: 8
Country: Ireland (ie)
Guys,

I am looking for a bit of help here. I want to make a field become editable after one week, everyweek.

I am new to this, so please go easy :)

Cheers


Top
 Profile E-mail  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 6:14 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 7039
Location: L.I., New York
Country: United States (us)
What kind of field? Does this record have a start date or posting date that can be used to calculate it's age?

_________________
Harry Ruiz
http://www.BiloBeauty.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 6:16 pm 
Offline

Joined: Mon Oct 10, 2011 9:50 am
Posts: 8
Country: Ireland (ie)
Savatage wrote:
What kind of field? Does this record have a start date or posting date that can be used to calculate it's age?


It is a password field - What I need is every week the user can change there password. Once a change has been made it will then become uneditable till the next week :)

Thanks


Top
 Profile E-mail  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 6:27 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4532
Location: Hyderabad
Country: India (in)
Is there any Date field existing on the table to calculate the week like "Last Modified Date".

and in which table?

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 6:30 pm 
Offline

Joined: Mon Oct 10, 2011 9:50 am
Posts: 8
Country: Ireland (ie)
mohana_cse06 wrote:
Is there any Date field existing on the table to calculate the week like "Last Modified Date".

and in which table?


Yes there is an existing field "Password Last Changed" which has the last time the password was changed.

Its on a Staff table.

Thanks :)


Top
 Profile E-mail  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 6:53 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4532
Location: Hyderabad
Country: India (in)
Try this code in Form - OnAfterGetRecord() and Password Last Changed - OnAfterValidate() triggers..

Code: Select all
CurrForm.Pwd.EDITABLE := (CALCDATE('<-1W>',"Password Last Changed") > WORKDATE);

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 7:01 pm 
Offline

Joined: Mon Oct 10, 2011 9:50 am
Posts: 8
Country: Ireland (ie)
mohana_cse06 wrote:
Try this code in Form - OnAfterGetRecord() and Password Last Changed - OnAfterValidate() triggers..

Code: Select all
CurrForm.Pwd.EDITABLE := (CALCDATE('<-1W>',"Password Last Changed") > WORKDATE);



Mmmh Seems like Im missing something


Attachments:
Error.JPG
Error.JPG [ 53.8 KiB | Viewed 1344 times ]
Top
 Profile E-mail  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 7:17 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 7039
Location: L.I., New York
Country: United States (us)
so "password last changed" is a datetime field?

use this function
Date := DT2DATE(Datetime)

The datetime of which you want to return the date part.
http://msdn.microsoft.com/en-us/library/dd301385.aspx

_________________
Harry Ruiz
http://www.BiloBeauty.com
http://www.autismspeaks.org


Last edited by Savatage on Wed Feb 15, 2012 7:19 pm, edited 1 time in total.

Top
 Profile E-mail WWW  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 7:19 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4532
Location: Hyderabad
Country: India (in)
I guess Password Last Changed is datetime field not date type...

So try

Code: Select all
CurrForm.Pwd.EDITABLE := (CALCDATE('<-1W>',DT2DATE("Password Last Changed")) > WORKDATE);

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 8:35 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5346
Location: Prague
Country: Czech Republic (cz)
Guys, lets help Dayzer to do it properly.

The correct way to do this is to add code to the onvalidate trigger of the field and give an error. Not making the field non editable in the form. [-X

Can you imagine what you are teaching him? Instead of testing fields and checking as is standard in Navision, he is going to think its OK to write code that makes fields on forms editable to prevent users changing them.

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 9:35 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 7039
Location: L.I., New York
Country: United States (us)
DaysSinceLastChanged := TODAY-DT2DATE("Password Last Changed");
if DaysSinceLastChanged < 8 then begin
Error('Password Change Not Allowed');
end else begin
"Password Last Changed" := today;
modify;
end;

but what's forcing them to make the change?
What form/table is this "User Table"?, are you having it pop up each week by calcing the expiration date?
are they changing it every week? why?
If I had to change passwords every week I'd quickly forget which I have used last.

_________________
Harry Ruiz
http://www.BiloBeauty.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 10:22 pm 
Offline

Joined: Mon Oct 10, 2011 9:50 am
Posts: 8
Country: Ireland (ie)
Savatage wrote:
DaysSinceLastChanged := TODAY-DT2DATE("Password Last Changed");
if DaysSinceLastChanged < 8 then begin
Error('Password Change Not Allowed');
end else begin
"Password Last Changed" := today;
modify;
end;

but what's forcing them to make the change?
What form/table is this "User Table"?, are you having it pop up each week by calcing the expiration date?
are they changing it every week? why?
If I had to change passwords every week I'd quickly forget which I have used last.


Well thanks everyone - Im going to do this right. So let me explain what I want to do :)

I have a Password field that I need to change every Month for each ID.
I need a msg to pop up every time it has to change.
It needs to be forced every month.

I am currently using a Staff table (This is not the main user table)

Thanks everyone :P


Top
 Profile E-mail  
 
 Post subject: Re: If Number of days passed allow field to become editable
PostPosted: Wed Feb 15, 2012 10:35 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Aug 14, 2001 7:01 am
Posts: 5346
Location: Prague
Country: Czech Republic (cz)
Dayzer wrote:
I have a Password field that I need to change every Month for each ID.


What do you mean by Password? If you mean the Navision log in password or something like that, then all this is managed in Active Directory and has no place what so ever in Navision.

If this is some kind of secondary password management process, then maybe you are doing the whole thing wrong and need to explain what you are doing and why.

_________________
David Singleton
Dynamics NAV Freelancer
Dynamics Book
Go-Live International


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: