• Japleen Kaur
  • NEWBIE
  • 30 Points
  • Member since 2016
  • Appirio

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
List<sObject> allResult= OV_Searchcc360.isDuplicate(objectType, fields, sources, null);

So allResult is a List of array having multiple records of one object , each record having several fields. I need to use 2 fields from this collection in a key value pair ie:- Id and Score field present inside the array. so i written this below code to iterate.

List<Map<String,String>> allResultMap = new List<Map<String,String>>(); 
              
        for(sObject objSObject : allResult)
        Map<String,String> finalResultMap = new Map<String,String>();   
         {
          allResultMap.put(objSObject.DSE__DS_Account__c, objSObject.DSE__DS_Score__c);
          system.debug('-------allResultMap-----'+allResultMap);    
          }
     
But it is showing that value doesnt exist :DSE__DS_Account__c and  DSE__DS_Score__c. But both fields present in the array. Please help.

And after this I need to sort according to score points.        
Hi All,
I have 3 quick actions which are calling 3 different lightning components. I need to merge all into 1 single lightning component. So, is there any way of getting quick action name in controller basis which I can render my functionality?
Or any other approach for achieving this?
Thanks
Can we edit an archived article?
If so, then what permissions are required?

PS: I have already given "Manage articles" and "CRUD on article type" permissions to my user.
@isTest(SeeAllData=true)
private class NumberOfAccountsRelatedToUserTest {
	
	@isTest static void test_method_one() {
		Integer num = 5;
		List<Account> accounts = createAccounts(num);
		List<Contact> contacts = createContacts(num, accounts);

		List<Account> accounts2 = createAccounts(num);
		List<Contact> contacts2 = createContacts(num, accounts2);

		User u  = createUser('myname', 'myname');
		User u2 = createUser('Test', 'Test');

		System.runAs(u){
			insert accounts;
			insert contacts;
		}

		System.runAs(u2){
			insert accounts2;
			insert contacts2;
		}

		Test.startTest();

			for(Account acc: accounts){
				acc.Account_Notes__c = 'Test Update';
				acc.SDR_Owner__c = u2.ID;
			}	

			update accounts;




		Test.stopTest();


	}


	public static User createUser(String username ,String theAlias){
		User u = new User(
			Alias = theAlias,
			Email = username + '@test.com',
			FirstName = 'Joe',
			LastName = username,
			TimeZoneSidKey = 'America/Los_Angeles',
			UserName = username + '@test.com',
			LocaleSidKey = 'en_US',
			EmailEncodingKey = 'UTF-8',
			LanguageLocaleKey = 'en_US'
			);

		u.profileID = userinfo.getProfileId();


		return u;
	}

	public static List<Account> createAccounts(Integer numOfAccounts){
		list<Account> accountsToInsert = new List<Account>();

		for(integer i = 0; i < numOfAccounts; i++){
			Account newAccount = new Account(
				Name = 'Test' + String.valueOf(i),
				Industry = 'Accounting',
				of_Locations__c = 5 + i
				);

			accountsToInsert.add(newAccount);

		}


		return accountsToInsert;
	}

	public static List<Contact> createContacts(Integer numOfContacts, List<Account> accounts){

		list<Contact> contactsToInsert = new List<Contact>();

		for(Integer i = 0; i < numOfContacts; i++){
			Contact newCon = new Contact (
				lastName 	= 'Test' + String.valueOf(i) ,
				accountId 	= accounts[i].ID ,
				title 		= 'Test' ,
    			email 		= String.valueOf(i) + 'test@test.com'
				);
			contactsToInsert.add(newCon);
		}

		return contactsToInsert;
	}
	
	
}

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATES_DETECTED, You're creating a duplicate record. We recommend you use an existing record instead.: []

Class.NumberOfAccountsRelatedToUserTest.test_method_one: line 22, column 1

How on earth am I creating a duplicate record???
Hello,

I have parent objet ParentX and child object childY.
I want to have related list of ChildY on parentX records.

My question is, i need tocreate lookup on child or parent ?

Thanks 
  • February 05, 2019
  • Like
  • 0
Hi Folks,

Is there a way to add new search layout for tasks? I have to add the status field to the search layout for Tasks and I don't see any search layouts for Tasks. I added it to the activity search layout but that did not change anything on tasks.
Can we edit an archived article?
If so, then what permissions are required?

PS: I have already given "Manage articles" and "CRUD on article type" permissions to my user.
List<sObject> allResult= OV_Searchcc360.isDuplicate(objectType, fields, sources, null);

So allResult is a List of array having multiple records of one object , each record having several fields. I need to use 2 fields from this collection in a key value pair ie:- Id and Score field present inside the array. so i written this below code to iterate.

List<Map<String,String>> allResultMap = new List<Map<String,String>>(); 
              
        for(sObject objSObject : allResult)
        Map<String,String> finalResultMap = new Map<String,String>();   
         {
          allResultMap.put(objSObject.DSE__DS_Account__c, objSObject.DSE__DS_Score__c);
          system.debug('-------allResultMap-----'+allResultMap);    
          }
     
But it is showing that value doesnt exist :DSE__DS_Account__c and  DSE__DS_Score__c. But both fields present in the array. Please help.

And after this I need to sort according to score points.