How to copy Advance query for other users, that is created by one user
Views (167)
Many a times we came accross an issue. for any report or form, when we make a complex query to display the records we have to enter the same ranges and criterias for all the users.
Here is the code by which you can just copy the query for all the other users. This will copy all advance queries created by from user.
static void advanceFilterQueries(Args _args)
{
SysLastValue sysLastValue;
UserId fromUserId, toUserId;
;
fromUserId = "user1"; // Enter ID of the user from where to copy
toUserId = "user2"; // Enter ID of the user where you want to copy
while select sysLastValue
where sysLastValue.recordType == UtilElementType::UserSetupQuery
&& sysLastValue.UserId == fromUserId
{
sysLastValue.UserId = toUserId;
sysLastValue.RecId = 0;
sysLastValue.insert();
}
}
Here is the code by which you can just copy the query for all the other users. This will copy all advance queries created by from user.
static void advanceFilterQueries(Args _args)
{
SysLastValue sysLastValue;
UserId fromUserId, toUserId;
;
fromUserId = "user1"; // Enter ID of the user from where to copy
toUserId = "user2"; // Enter ID of the user where you want to copy
while select sysLastValue
where sysLastValue.recordType == UtilElementType::UserSetupQuery
&& sysLastValue.UserId == fromUserId
{
sysLastValue.UserId = toUserId;
sysLastValue.RecId = 0;
sysLastValue.insert();
}
}
This was originally posted here.
*This post is locked for comments