Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Query to fetch account details

saiKrishna
Regular Contributor
Regular Contributor

Hello Team,

Can someone please help me with the query to fetch the records for the accounts customproperty5 was updated from last 2 hours.

4 REPLIES 4

Raghu
Valued Contributor III
Valued Contributor III

SELECT count(*)
FROM accounts
WHERE customproperty5 >= NOW() - INTERVAL 2 HOUR;


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

itinjic
Regular Contributor
Regular Contributor

o fetch the records for the accounts where customproperty5 was updated in the last 2 hours, you can use the following query:

```
SELECT * FROM ACCOUNTS WHERE LASTUPDATE > NOW() - INTERVAL 2 HOUR AND customproperty5 IS NOT NULL
```

This query retrieves all the records from the ACCOUNTS table where the LASTUPDATE column is within the last 2 hours and customproperty5 is not null. You can modify the query according to your specific table and column names.

If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

rushikeshvartak
All-Star
All-Star

How customproperty5 is updated ? Via import ?

SELECT name,updatedate,customproperty5 FROM ACCOUNTS WHERE updatedate > NOW() - INTERVAL 2 HOUR AND customproperty5 IS NOT NULL

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

PremMahadikar
Valued Contributor
Valued Contributor

Hi @saiKrishna ,

I don't think the below query will fetch you accurate results if there is already CP5 value present in the account. Let's say, there is also an update on other attributes, this query will fetch that record as well.

WHERE updatedate > NOW() - INTERVAL 2 HOUR AND customproperty5 IS NOT NULL

 And there is no way to see the previous value already present in customproperty5.

 

1. If its import: This can be achieved using backup of the original value:

  1. Use Enhanced Query and run this job with the import using trigger chain
  2. Your Enhanced Query will copy the value of CP5 to any other account value
  3. Query: SELECT ac.customproperty5 AS accounts__customproperty6, ac.accountkey as ACCOUNTS__PRIMARYKEY FROM ACCOUNTS ac where ac.accountkey IN('456');
  4. Now you can query comparing the value of CP5 and CP6 using the same suggested queries above

2. If its UI update: Check Audit Trail and select ObjectType as 'Accounts', you can see the updates for any account performed through Saviynt

 

If this solution helps your question, please consider selecting Accept As Solution and hit Kudos