• AMIT AGRAWAL 5
  • NEWBIE
  • 25 Points
  • Member since 2014


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
Hi All,

Here is the change I am looking to make:

If fieldA (SortType_C) from CustomObject_C =  BLANK then change value of SortType_C to "Other"

I am a new administrator and learning fast, I managed to access the developer console but I am new to DML.

Can anyone help me with the code?

Thanks,

Dave The Rave
I need to fetch the user login history based on the user id's I have but I need to fetch only limited no of login history records for each user. I thought of running a parent to child soql for that with limit clause like -

for(User objUser: [SELECT Id, Name, (SELECT Id,Browser,LoginTime FROM LoginHistories ORDER BY LoginTime DESC LIMIT 10) FROM User LIMIT 10]) {
    for(LoginHistory objLoginHistory: objUser.LoginHistories)
        System.debug('LoginHistory:'+ objLoginHistory);
}

This way I can get latest 10 login history records for each user. But Salesforce is not identifying the relationship name 'LoginHistories' here. 
I tried to get the relationship name from the ChildRelationship class using below code but its showing null value for 'Login History' object relationship name.

for(Schema.ChildRelationship cr : user.SObjectType.getDescribe().getChildRelationships()){
    System.debug('child::>>>' + cr.getChildSObject() + ' reversed is: ' + cr.getRelationshipName());
}

Please tell me if that is not possible to run soql from user to login history like this or is there any other way I can get it done ?
Hi All,

Here is the change I am looking to make:

If fieldA (SortType_C) from CustomObject_C =  BLANK then change value of SortType_C to "Other"

I am a new administrator and learning fast, I managed to access the developer console but I am new to DML.

Can anyone help me with the code?

Thanks,

Dave The Rave
I need to fetch the user login history based on the user id's I have but I need to fetch only limited no of login history records for each user. I thought of running a parent to child soql for that with limit clause like -

for(User objUser: [SELECT Id, Name, (SELECT Id,Browser,LoginTime FROM LoginHistories ORDER BY LoginTime DESC LIMIT 10) FROM User LIMIT 10]) {
    for(LoginHistory objLoginHistory: objUser.LoginHistories)
        System.debug('LoginHistory:'+ objLoginHistory);
}

This way I can get latest 10 login history records for each user. But Salesforce is not identifying the relationship name 'LoginHistories' here. 
I tried to get the relationship name from the ChildRelationship class using below code but its showing null value for 'Login History' object relationship name.

for(Schema.ChildRelationship cr : user.SObjectType.getDescribe().getChildRelationships()){
    System.debug('child::>>>' + cr.getChildSObject() + ' reversed is: ' + cr.getRelationshipName());
}

Please tell me if that is not possible to run soql from user to login history like this or is there any other way I can get it done ?
I have CustomObjB which has lookup to user. I want to query on user and need to fetch the related child i.e. customobjb record.
I tried with plural form but its showing  "Unknown error parsing query" as blank spaces are there in the plural form.
How can i query ?
ss
User-added imageUser-added imageUser-added image
Is anyone encountering this error :

"Challenge not yet complete... here's what's wrong: 
The 'Set Case to Escalated' Workflow field update action was not found."

Not sure what's going wrong, but the action sure is there !