• Leonard Silon 8
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 13
    Replies
We use LiveOps for a dialer connected to SFDC. When a user wraps up a call the app allows them to fill in a few standard task fields. When the user saves, LiveOps creates a task record in Salesforce. The app does not allow for customization so that the user can enter values in custom fields we have on the task record. 

I want to be able to auto pop up that task (right after creation) in edit mode so the user can enter those custom fields. This will eliminate the need for the user to find the task jsut created and manually edit those fields.

Let's say SFDC knows this is a task created by that app because a checkbox field is checked - call the field "LiveOps Created"

Can this be done via config or trigger or VF or combo of all that and how?
On the contact if a user attaches a file ot the notes and attachments with a file name that begins with "Opt-Up Professional" that a check box named Opt-Up Attached gets checked. I have read enough to know a trigger is needed. However, I can not find anythign specific to my needs. Does anyone have code they can share with me - - please note while i can basically read code, I am not a developer. We also have no developer on site so any help would be greatly appreciated!!
I am helping my developer by posting this. Here is teh trigger code, followed by the test class code followed by the picture of the failure notice when trying to validate in production. The trigger works in the sandbox. Failure happens when validating the change set. What is the issue?
TRIGGER:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
trigger updateContactOwnerWithTerritory2 on Territory__c (after update) {
    List<User> users = [select Id, Name from User]; 
    List<Id> contactIds = new List<Id>();
    Map<Id, Id> extWholesailers = new Map<Id, Id>();
    
    for (Territory__c territory: trigger.new) {
        
        if (trigger.oldMap.get(territory.Id).Ext_Wholesaler__c != territory.Ext_Wholesaler__c) {
          Boolean userFound = false;
            User user;
            for (Integer j = 0; (j < users.size() && !userFound); j++) {
                
                System.debug('User name ' + users[j].Name.trim().toLowerCase());
                System.debug('Territory ext wholesaler ' + territory.Ext_Wholesaler__c);
                
                if((territory.Ext_Wholesaler__c != null) && (users[j].Name.trim().toLowerCase() == territory.Ext_Wholesaler__c.trim().toLowerCase())) {
                    user = users[j];
                    userFound = true;
                }
            }
            
            if (userFound) {
                extWholesailers.put(territory.Id, user.Id);
            }
        }

    }
    
    for (Contact contact: [select Id, Territory__c, OwnerId from Contact where Territory__c in : extWholesailers.keySet()]) {
        
        if (extWholesailers.containsKey(contact.Territory__c) && contact.OwnerId != extWholesailers.get(contact.Territory__c)) {
            contactIds.add(contact.Id);
        }       
    }
    
    System.debug('Contacts to be updated' + contactIds.size());
    System.debug('Territories ' + extWholesailers.keySet().size());
    
    if (System.isFuture() || System.isBatch()) {
        System.debug('this trigger can\'t be triggered by a batch/future process');
    } else {
            updateContactOwnerUtility.updateContactOwners(contactIds, extWholesailers, 10000);

TEST CLASS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@isTest(SeeAllData=true)
public class updateContactOwnerWithTerritory2_test {
  static testMethod void validateOwnerAllocationDuringTerritoryUpdate() {
      List<Territory__c> territories = [select Id, Ext_Wholesaler__c from Territory__c where Ext_Wholesaler__c != null and (not Ext_Wholesaler__c like 'WHOLESALER:%') limit 10];
    
      Boolean completed = false;
        
        for (Integer i = 0; (i < territories.size() && !completed); i++) {
            Territory__c territory = territories[i];
            List<User> users = [select Id, Name from User where (Name != null) and (not Name like :territory.Ext_Wholesaler__c) limit 1];
            
            if (users.size() > 0) {
                completed = true;
                User user = users[0];
                
                territory.Ext_Wholesaler__c = user.Name;
                Test.startTest();
                update territory;
                Test.stopTest();
                
                List<Contact> contacts = [select Id, OwnerId, Territory__c from Contact where Territory__c =: territory.Id]; 
                
                for (Contact contact: contacts) {
                    System.assertEquals(contact.OwnerId, user.Id);
                }
            }
        }
    }
}

ERROR SCREEN SHOT
User-added image
I have a button on the contact with the following code - /00O30000004Ixcq?pv0={!IF((Contact.MailingStreet=""),Contact.ACS_BID__c&Contact.ACS_FID__c,Contact.MailingStreet)}&pv1={!Contact.ACS_BID__c}&pv2={!Contact.ACS_FID__c}

This works perfectly in full web version. On SF1 it runs the report with no criteria. SFDC says this is expected behavior. Anyone know how to get something like this to work in both web and SF1 versions?
I saw other posts precenting usage of SFDC itself. All I want is to not allow a user to post a first post in Chatter unless they have "signed" acknowledgement of the acceptable use policy.

So they can continue to use Salesforce as they are today. However, when they try to post their first post they are prevented unless they acknowledged the policy. Otherwise allow them to post.

Thoughts or links to similar thoughts?
I have two objects - Object A and Object B
Object A has a field that looks up to Object B and is the record label
On object B there is a text field with a user's full name in the firmat of "firstname Lastname"
I need to be able to look at that field and then make the user in the text field on Object B be the owner of the record in Object A

Example
Object B
Record name = 107 Mark*John
Text field data = Mark Jones

Object A
Lookup field has a link to Object B and in that field is "107 Mark*John"
Since that is the record connected to Object A and "Mark Jones" is in the text field on Object B, I want the owner of that record in Object A to now be Mark Jones and updated any time the look up field on Object A changes

Any help welcomed!
I have a few buttons that when clicked open up a report. Sometimes they open in a new tab and sometimes they open in a new window. How can I for it to always open in a new tab?

The below picture is an example of one that opens in a new tab. I have another button where everything is exactly the same except the URL and it opens in a new window.  Thoughts?

User-added image
I need to know if this is possible with process builder or need it in a trigger.

1. I have a contact object with a field named Territory
2. The territory field is a lookup to the custom object named territory
3. on the territory object it contains a field named "external owner". This is a system entered field that does not look up to the user record

What I need is if the terriroty is manually changed on the contact, then the contact owner name changes to the new owner. How do I look up on the user object to link it to the new owner of the contactss automatically when the territory changes?   
On the contact if a user attaches a file ot the notes and attachments with a file name that begins with "Opt-Up Professional" that a check box named Opt-Up Attached gets checked. I have read enough to know a trigger is needed. However, I can not find anythign specific to my needs. Does anyone have code they can share with me - - please note while i can basically read code, I am not a developer. We also have no developer on site so any help would be greatly appreciated!!
I am helping my developer by posting this. Here is teh trigger code, followed by the test class code followed by the picture of the failure notice when trying to validate in production. The trigger works in the sandbox. Failure happens when validating the change set. What is the issue?
TRIGGER:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
trigger updateContactOwnerWithTerritory2 on Territory__c (after update) {
    List<User> users = [select Id, Name from User]; 
    List<Id> contactIds = new List<Id>();
    Map<Id, Id> extWholesailers = new Map<Id, Id>();
    
    for (Territory__c territory: trigger.new) {
        
        if (trigger.oldMap.get(territory.Id).Ext_Wholesaler__c != territory.Ext_Wholesaler__c) {
          Boolean userFound = false;
            User user;
            for (Integer j = 0; (j < users.size() && !userFound); j++) {
                
                System.debug('User name ' + users[j].Name.trim().toLowerCase());
                System.debug('Territory ext wholesaler ' + territory.Ext_Wholesaler__c);
                
                if((territory.Ext_Wholesaler__c != null) && (users[j].Name.trim().toLowerCase() == territory.Ext_Wholesaler__c.trim().toLowerCase())) {
                    user = users[j];
                    userFound = true;
                }
            }
            
            if (userFound) {
                extWholesailers.put(territory.Id, user.Id);
            }
        }

    }
    
    for (Contact contact: [select Id, Territory__c, OwnerId from Contact where Territory__c in : extWholesailers.keySet()]) {
        
        if (extWholesailers.containsKey(contact.Territory__c) && contact.OwnerId != extWholesailers.get(contact.Territory__c)) {
            contactIds.add(contact.Id);
        }       
    }
    
    System.debug('Contacts to be updated' + contactIds.size());
    System.debug('Territories ' + extWholesailers.keySet().size());
    
    if (System.isFuture() || System.isBatch()) {
        System.debug('this trigger can\'t be triggered by a batch/future process');
    } else {
            updateContactOwnerUtility.updateContactOwners(contactIds, extWholesailers, 10000);

TEST CLASS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@isTest(SeeAllData=true)
public class updateContactOwnerWithTerritory2_test {
  static testMethod void validateOwnerAllocationDuringTerritoryUpdate() {
      List<Territory__c> territories = [select Id, Ext_Wholesaler__c from Territory__c where Ext_Wholesaler__c != null and (not Ext_Wholesaler__c like 'WHOLESALER:%') limit 10];
    
      Boolean completed = false;
        
        for (Integer i = 0; (i < territories.size() && !completed); i++) {
            Territory__c territory = territories[i];
            List<User> users = [select Id, Name from User where (Name != null) and (not Name like :territory.Ext_Wholesaler__c) limit 1];
            
            if (users.size() > 0) {
                completed = true;
                User user = users[0];
                
                territory.Ext_Wholesaler__c = user.Name;
                Test.startTest();
                update territory;
                Test.stopTest();
                
                List<Contact> contacts = [select Id, OwnerId, Territory__c from Contact where Territory__c =: territory.Id]; 
                
                for (Contact contact: contacts) {
                    System.assertEquals(contact.OwnerId, user.Id);
                }
            }
        }
    }
}

ERROR SCREEN SHOT
User-added image
I saw other posts precenting usage of SFDC itself. All I want is to not allow a user to post a first post in Chatter unless they have "signed" acknowledgement of the acceptable use policy.

So they can continue to use Salesforce as they are today. However, when they try to post their first post they are prevented unless they acknowledged the policy. Otherwise allow them to post.

Thoughts or links to similar thoughts?
I have two objects - Object A and Object B
Object A has a field that looks up to Object B and is the record label
On object B there is a text field with a user's full name in the firmat of "firstname Lastname"
I need to be able to look at that field and then make the user in the text field on Object B be the owner of the record in Object A

Example
Object B
Record name = 107 Mark*John
Text field data = Mark Jones

Object A
Lookup field has a link to Object B and in that field is "107 Mark*John"
Since that is the record connected to Object A and "Mark Jones" is in the text field on Object B, I want the owner of that record in Object A to now be Mark Jones and updated any time the look up field on Object A changes

Any help welcomed!
I need to know if this is possible with process builder or need it in a trigger.

1. I have a contact object with a field named Territory
2. The territory field is a lookup to the custom object named territory
3. on the territory object it contains a field named "external owner". This is a system entered field that does not look up to the user record

What I need is if the terriroty is manually changed on the contact, then the contact owner name changes to the new owner. How do I look up on the user object to link it to the new owner of the contactss automatically when the territory changes?