Sys_updated_on only for active field to get query ?

sukran
Mega Sage

Hi 

we 're trying to query the records in user table(sys_user) that the only active field was updated on last two days but somewhat the users records getting other fields updated daily basis and updated by integration feed even after the record was inactive , so its not querying correct details for(sys_updated_on ) for active field updated before last two days .. how to get query that only active field is updated on last two days

 

Computer form - owned by is a reference field and we're looking owned by user table field is active was updated before 2 days

please find the attached screenshot

find_real_file.png

 

 

 

 

find_real_file.png

6 REPLIES 6

graham_c
Tera Guru

Hi Sukran,

You would need to add a new date/time or date field onto the sys_user table (called something like "Deactivated") to track when the user has been deactivated. You can then build a business rule that sets the Deactivated date to gs.now() when the Active field changes from true to false.

You can then query the deactivated field instead of the updated field to understand when the user was no longer active.

Thanks

P.S - If this has answered your question or has been helpful please mark your question as answered.

 

newinworld
Tera Contributor

HI Sukaran, 

You would need to add a new date/time or date field onto the sys_user table which is right.

You need to write the business rule in such way that when active is checked then the Time Calculation needs to run and other way for Active field deactivated then stop the BR and calculate the time difference 

Archana Reddy2
Tera Guru

Hi Sukran,

Let me tell you my understanding of the question and correct me if I am wrong.

On the Computer table, you have Owned by field which is referenced to User table.

You want to check for the user records whose active field is updated in the last 2 days and get them.

My doubt: Only records with active field updated should be fetched (or) any other field updation along with active field should also be fetched?

Answering these questions helps us in better understanding of the question.

Thanks,

Archana

Yes Archana , your understanding is correct - On the Computer table, you have Owned by field which is referenced to User table.

 and yes - Only records with active field updated should be fetched

 

If ownedby user is inactive ( before 2 days) then that particular record should be changed to termination in the computer asset recovery form

 

here , the data gathering all fields are updated before last 2 days which is not we required

 

how to get only active field is updated last 2 days before?