You need to sign in to do that
Don't have an account?
chanbasha nbsk
How to assign new cases to custom object records?
Hi,
I have taken two objects Case and one custom object.i have created some records in custom object with availability checkbox(just checkbox only) is checked and some records are unchecked with availability checkbox.
I wrote a soql query to get availability checkbox records:
List<CaseUser__c> cuser =[SELECT id,Name FROM CaseUser__c where Availability__c=true ORDER BY Name ASC];
by this query i can get all availability records but my point is when i created a new case it is assign to first record in custom object and next if i create a new case then assign to a second record like this furher.....
by using the trigger how can i achieve this
my trigger is
trigger CaseUserAssiginingTrigger on Case (after insert,after update){
List<ID> ids = new List<ID>();
for(Case c : Trigger.new){
if (c.Reason != null) {
ids.add(c.Id);
}
}
//getting all available users
List<CaseUser__c> cuser =[SELECT id,Name FROM CaseUser__c WHERE Availability__c=true
ORDER BY Name ASC];
//add some logic here
Thanks
Thanks
I have taken two objects Case and one custom object.i have created some records in custom object with availability checkbox(just checkbox only) is checked and some records are unchecked with availability checkbox.
I wrote a soql query to get availability checkbox records:
List<CaseUser__c> cuser =[SELECT id,Name FROM CaseUser__c where Availability__c=true ORDER BY Name ASC];
by this query i can get all availability records but my point is when i created a new case it is assign to first record in custom object and next if i create a new case then assign to a second record like this furher.....
by using the trigger how can i achieve this
my trigger is
trigger CaseUserAssiginingTrigger on Case (after insert,after update){
List<ID> ids = new List<ID>();
for(Case c : Trigger.new){
if (c.Reason != null) {
ids.add(c.Id);
}
}
//getting all available users
List<CaseUser__c> cuser =[SELECT id,Name FROM CaseUser__c WHERE Availability__c=true
ORDER BY Name ASC];
//add some logic here
Thanks
Thanks
Please find the sample code below and tweak it as per your requirement.
- Considering Case__c as Lookup field on CaseUser__c object
Hope this helps.Please mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are encountering similar issue.
Best Regards,
Nagendra.