• pandi GS
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 12
    Replies
Hi,
We are in need to send our data to external systems(tableau & powerBuilderBI) via connectors. We can achieve it via below process
1. create System admin users for Tableu & BuilderBI team
Downfall: it will give access to all objects and full access & license cost
2. Create 2 standard user with MFA and required object access
Downfall: license cost
3. Create 2 API Only user & required object access
Downfall: license cost
4. Create 1 API Only user & required object access & share the login credentials to both teams
Downfall: If any one team locks the account, then it will impact both and both team can see 2 teams objects.

Which is best to proceed with? Is there any other approaches?

Hi 
suddenly we got the below error in our community site and also not able to access my community site builder in our sandboxes . 


is there any solution how to fix it ? We raised a ticket to salesforce as well

thanks 
 

HI, 
I am iterating the list and i want to display in the columns.  i am checking the index inside the iteration, and when i compare in aura if, it is not working. The check always goes to ELSE part only. What mistake i'm doing? please help
<aura:attribute name="ALCDMLst" type="List" default="[
     {'label': 'All Adults', 'value': 'AllAdult','Child':[]},
    {'label': 'Lifestyle Topics', 'value': 'option1','Child':[{'label':'Unhealthy Diet','value':'UD'},{'label':'Inadequate Exercise','value':'IE'},{'label':'Stress','value':'ST'}]},
    {'label': 'Heart and Blood Vessel Conditions', 'value': 'option2','Child':[{'label':'Blood Clot','value':'BC'},{'label':'Heart Failiure','value':'HF'},{'label':'Stroke','value':'SK'}]},
	{'label': 'Diabetes', 'value': 'option3','Child':[]},
    {'label': 'Lung Condition', 'value': 'option4','Child':[{'label':'Asthma','value':'AS'},{'label':'COPD','value':'CPD'}]},
	{'label': 'Stomach and Intenstine Conditions', 'value': 'option5','Child':[{'label':'Chronic hepatitis B or C','value':'hipa'},{'label':'Stomach Ulcer','value':'SCU'}]},
	{'label': 'Cancer', 'value': 'option6','Child':[{'label':'Colon','value':'CN'},{'label':'Lung','value':'LG'}]}
    ]"/>

<aura:iteration var="oppz" items="{!v.ALCDMLst}" indexVar="indexs">
                  
<aura:if istrue="{!lessthan(indexs , 3)}">
True
<aura:set attribute="else">
False
</aura:set>
</aura:if>

 
HI,
I created a communities and in the home page i drag and dropped the lightining components and it is having search functionality. My requirement is
1. Now upon clicking the link in the search it has to redirect to a page will allow edit the record, 
2. Need a brand new page and to setup a navigation menu in the navigation and upon click hte menu it should take to the new page., I dont know how to create a page and call in communities.

Please help
Thanks
 
I am creating a multiple rows with textbox via aura iteration and on click of the button i want to show error to the row which having errors such as blank textbox or invalid number. I can iterate and found the error but dont know to how to show the error like V.Error, "Invalid Input" to that particular row. Currently showing with message box.
Hi,
We are in need to send our data to external systems(tableau & powerBuilderBI) via connectors. We can achieve it via below process
1. create System admin users for Tableu & BuilderBI team
Downfall: it will give access to all objects and full access & license cost
2. Create 2 standard user with MFA and required object access
Downfall: license cost
3. Create 2 API Only user & required object access
Downfall: license cost
4. Create 1 API Only user & required object access & share the login credentials to both teams
Downfall: If any one team locks the account, then it will impact both and both team can see 2 teams objects.

Which is best to proceed with? Is there any other approaches?

Hi 
suddenly we got the below error in our community site and also not able to access my community site builder in our sandboxes . 


is there any solution how to fix it ? We raised a ticket to salesforce as well

thanks 
 

How to terminate chatbot session programatically from client side javascript?

Is there any method that i can use on the embedded_svc? e.g embedded_svc.endChatSession();

I have a deploy where I am trying to pop open the chat. This is current deploy:

      <script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
      <script type='text/javascript'>
          var initESW = function(gslbBaseURL) {
              embedded_svc.settings.displayHelpButton = true;
              embedded_svc.settings.language = ''; 

              embedded_svc.settings.enabledFeatures = ['LiveAgent'];
              embedded_svc.settings.entryFeature = 'LiveAgent';

              embedded_svc.init(
                  'https://na85.salesforce.com',
                  'https://myURL',
                  gslbBaseURL,
                  'code',
                  'Live_Chat',
                  {
                      baseLiveAgentContentURL: 'https://c.la2-c1-ph2.salesforceliveagent.com/content',
                      deploymentId: 'myID',
                      buttonId: 'buttonID',
                      baseLiveAgentURL: 'https://d.la2-c1-ph2.salesforceliveagent.com/chat',
                      eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04I1U000000PKJLUA4_16d1d642827',
                      isOfflineSupportEnabled: true
                  }
              );
          };
        if (!window.embedded_svc) {
          var s = document.createElement('script');
          s.setAttribute('src', 'https://na85.salesforce.com/embeddedservice/5.0/esw.min.js');
          s.onload = function() {
            initESW(null);
          };
          document.body.appendChild(s);
        } else {
          initESW('https://service.force.com');
        }
      </script>

But I was wondering if it was possible to have a method that was like embedded_svc.settings.popOpenChat -= true because I want it to pop open not just live as the helpbutton.... Is this doable? If so, what's the right javascript API method?

I am creating a multiple rows with textbox via aura iteration and on click of the button i want to show error to the row which having errors such as blank textbox or invalid number. I can iterate and found the error but dont know to how to show the error like V.Error, "Invalid Input" to that particular row. Currently showing with message box.
Hi,
  Please give me steps to post a question in developer.salesforce.com after login in.
  I have had hard time to find a button: "Post a question", sometimes it does not come up.

Thanks
​tina

I have set up a community on sandbox environment. I had created some pages from community builder and added some lightning components to them. Builder was showing pages and I was able to edit them till yesterday. But today if I select any of the pages in page editor, it just shows blank page and nothing is visible. I can not modify it. In preview also it just shows blank page. 

Now when I created a new community and created new pages, the builder of new community works just fine. It shows page contents in page editor and I can modify them. 

Why is this happening? Am I missing anything here? Does anybody has any suggestions to avoid such issues in future?

I have nearly completed a registration handler for our community that uses person accounts, but need a little help finishing up.  Below you can see my registration handler class, along with the corresponding test.  
  • Since this is for a community, do I have to specify the Salesforce License type of Customer Community Login user when creating the user?
  • I tried to create a person account, then capture the ContactId to use when creating the user, does that look complete?
Also, both the class and test save, and when the test runs, it says that it covers 100% of the class code, but it fails.  I get the following error:

System.DmlException: Update failed. First exception on row 0 with id 0054C000000M2VbQAK; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): User, original object: Account: []
Class.FamilySearchRegHandler.updateUser: line 52, column 1
Class.FamilySearchRegHandler_Test.testCreateAndUpdateUser: line 20, column 1

I found this suggestion, but I am not quite sure how to implement it.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_mix_sobjects_test_methods.htm

Any suggestions?
 
global class FamilySearchRegHandler implements Auth.RegistrationHandler{

global User createUser(Id portalId, Auth.UserData data){

    RecordType personAccountRecordType =  [SELECT Id FROM RecordType WHERE Name = 'Person Account' and SObjectType = 'Account'];
    Account newPersonAccount = new Account();
        // for person accounts we can not update the Name field instead we have to update the FirstName and LastName individually
        newPersonAccount.FirstName = data.firstName;
        newPersonAccount.LastName =  data.lastName;
        newPersonAccount.RecordType = personAccountRecordType;
        insert newPersonAccount;
    	
    	Contact c = [SELECT AccountId,Id FROM Contact WHERE AccountId = :newPersonAccount.Id];   
    
        //TODO: Customize the username and profile. Also check that the username doesn't already exist and
        //possibly ensure there are enough org licenses to create a user. Must be 80 characters or less.
        User u = new User();
        Profile p = [SELECT Id FROM profile WHERE name='Community - FS - Public'];
        u.username = data.username + '.fscommunity';
        u.email = data.email;
        u.lastName = data.lastName;
        u.firstName = data.firstName;
        String alias = data.username;
        //Alias must be 8 characters or less
        if(alias.length() > 8) {
            alias = alias.substring(0, 8);
        }
        u.alias = alias;
        u.languagelocalekey = UserInfo.getLocale();
        u.localesidkey = UserInfo.getLocale();
        u.emailEncodingKey = 'UTF-8';
        u.timeZoneSidKey = 'America/Denver';
        u.profileId = p.Id;
        u.contactId = c.Id;
        return u;
    } 


global void updateUser(Id userId, Id portalId, Auth.UserData data){
    User u = new User(id=userId);
    //TODO: Customize the username. Must be 80 characters or less.
    //u.username = data.username + '.fscommunity';
    u.email = data.email;
    u.lastName = data.lastName;
    u.firstName = data.firstName;
    //String alias = data.username;
    //Alias must be 8 characters or less
    //if(alias.length() > 8) {
        //alias = alias.substring(0, 8);
    //}
    //u.alias = alias;
    update(u);
}
}
 
@isTest
private class FamilySearchRegHandler_Test {
static testMethod void testCreateAndUpdateUser() {
    FamilySearchRegHandler handler = new FamilySearchRegHandler();
    Auth.UserData sampleData = new Auth.UserData('testId', 'testFirst', 'testLast',
        'testFirst testLast', 'testuser@example.org', null, 'testuserlong@fs.org', 'en_US', 'facebook',
        null, new Map<String, String>{'language' => 'en_US'});
    User u = handler.createUser(null, sampleData);
    System.assertEquals('testuserlong@fs.org.fscommunity', u.userName);
    System.assertEquals('testuser@example.org', u.email);
    System.assertEquals('testLast', u.lastName);
    System.assertEquals('testFirst', u.firstName);
    System.assertEquals('testuser', u.alias);
    insert(u);
    String uid = u.id;
    
    sampleData = new Auth.UserData('testNewId', 'testNewFirst', 'testNewLast',
        'testNewFirst testNewLast', 'testnewuser@example.org', null, 'testnewuserlong', 'en_US', 'facebook',
        null, new Map<String, String>{});
    handler.updateUser(uid, null, sampleData);
    
    User updatedUser = [SELECT userName, email, firstName, lastName, alias FROM user WHERE id=:uid];
    System.assertEquals('testnewuserlong@salesforce.com', updatedUser.userName);
    System.assertEquals('testnewuser@example.org', updatedUser.email);
    System.assertEquals('testNewLast', updatedUser.lastName);
    System.assertEquals('testNewFirst', updatedUser.firstName);
    System.assertEquals('testnewu', updatedUser.alias);
}
}

 
Hi All -

I have the below code for which I am trying to write the test method to test the bulkify of my code (with 300 Maintenance Requests)

Maintenance Request Helper:
public class MaintenanceRequestHelper {
    private static List<Case> closedCases = new List<Case>();
    private static List<Case> newlyCreatedCases = new List<Case>();
    private static List<Work_Part__c> allWorkParts = new List<Work_Part__c>();
    

    public static void updateAfterUpdateActivity(List<Case> newCases, Map<Id, Case> oldCases){
    	System.Debug('SUDIPTA- CALLED FOR: ' + newCases.size());
    	for(Case singleCase : newCases){
	    	if(singleCase.status == 'Closed' && oldCases.get(singleCase.ID).status != singleCase.status){
	    		if(singleCase.Type == 'Repair' || singleCase.Type == 'Routine Maintenance'){
	    			closedCases.add(singleCase);
	       		}
	    	}
	    }
	    createFollowUpMaintenanceRequest();
    }

    private static void createFollowUpMaintenanceRequest(){
    	Set<ID> caseIds = new Set<ID>();
    	for(Case singleCase : closedCases){
    		caseIds.add(singleCase.Id);
    	}
    	Integer shortestMaintCycle;
    	
    	Map<Id, List<Work_Part__c>> maintWorkPartMap = createMaintWorkPartMap(caseIds);

    	for(Case singleCase : closedCases){
    		List<Work_Part__c> workParts = maintWorkPartMap.get(singleCase.Id);
    		if(workParts != null){
    			shortestMaintCycle = Integer.valueOf(findShortestMaintCycle(workParts));	
    		}else{
    			shortestMaintCycle = Integer.valueOf(0.0);
    		}
    		

    		Case newCase = new Case();
    		newCase.Vehicle__c = singleCase.Vehicle__c;
    		newCase.Type = 'Routine Maintenance';
    		newCase.status = 'New';
    		newCase.Origin = singleCase.Origin;
    		newCase.Reason = singleCase.Reason;
    		newCase.Subject = String.isBlank(singleCase.Subject) ? 'Routine Maintenance Request' :
    			singleCase.Subject;
    		newCase.Date_Reported__c = Date.today();
    		newCase.Date_Due__c = Date.today().addDays(shortestMaintCycle);
    		newCase.Equipment__c = singleCase.Equipment__c;
    		//newCase.Old_Case__c = 'OldCase-'+String.valueOf(singleCase.Id);
    		//newCase.Old_Case__c = singleCase.Case_Id_String__c;
    		newlyCreatedCases.add(newCase);
    	}

    	if(newlyCreatedCases.size() > 0){
    		insert newlyCreatedCases;
    		//updateRelatedWorkOrders(newlyCreatedCases);
    	}
    }
    
    private static void updateRelatedWorkOrders(List<Case> cases){
    	Map<String, Id> oldToNewCaseMap = new Map<String, Id>();
    	for(Case singleCase : cases){
    		oldToNewCaseMap.put(singleCase.Old_Case__c,singleCase.Id);
    	}

    	if(allWorkParts != null){
    		for(Work_Part__c singleWorkPart : allWorkParts){
    			//String key = 'OldCase-'+String.valueOf(singleWorkPart.Maintenance_Request__c);
    			String key = String.valueOf(singleWorkPart.Maintenance_Request__c);
    			Id newCaseId = oldToNewCaseMap.get(singleWorkPart.Maintenance_Request__c);
    			singleWorkPart.Maintenance_Request__c = newCaseId;
    		}
    	}

    	if(allWorkParts != null && allWorkParts.size() > 0){
    		update allWorkParts;
    	}
    }

    private static Decimal findShortestMaintCycle(List<Work_Part__c> workParts){
    	Decimal shortestValue;
    	if(workParts.size()>0){
    		shortestValue = workParts.get(0).Equipment__r.Maintenance_Cycle__c;
    	}
    	for(Work_Part__c singleWorkPart : workParts){
    		if(singleWorkPart.Equipment__r.Maintenance_Cycle__c < shortestValue){
    			shortestValue = singleWorkPart.Equipment__r.Maintenance_Cycle__c;
    		}
    	}
    	return shortestValue;
    }

    private static Map<Id, List<Work_Part__c>> createMaintWorkPartMap(Set<ID> caseIds){
    	//Fetch all WorkPart details
    	allWorkParts = [SELECT ID, Equipment__c, Maintenance_Request__c, 
    			Quantity__c, Equipment__r.Maintenance_Cycle__c FROM Work_Part__c 
    			WHERE Maintenance_Request__c in: caseIds];
    	Map<Id, List<Work_Part__c>> maintWorkPartMap = new Map<Id, List<Work_Part__c>>();
    	for(Work_Part__c singleWorkPart : allWorkParts){
    		List<Work_Part__c> tempList;
    		if(maintWorkPartMap.get(singleWorkPart.Maintenance_Request__c) == null){
    			tempList = new List<Work_Part__c>();
    		}else{
    			tempList = maintWorkPartMap.get(singleWorkPart.Maintenance_Request__c);
    		}
    		tempList.add(singleWorkPart);
    		maintWorkPartMap.put(singleWorkPart.Maintenance_Request__c, tempList);
    	}

    	return maintWorkPartMap;
    }
    
}

And here is my test method-
@isTest
    static void test_Closing_300_Routine_Maintenance_should_create_300_New_Maint(){
    	//Arrange
    	Vehicle__c singleVehicle = TestDataFactory.createVehicle();
    	List<Product2> equipments = TestDataFactory.createEquipments();
    	List<Case> allMaintRequests = TestDataFactory.createMultipleMainRequestWith(
    					201,
    					singleVehicle,
    					'Routine Maintenance',
    					'Open',
    					'Email',
    					'Not Working',
    					'Not Working',
    					Date.today(),
    					Date.today().addDays(10),
    					equipments);
    	
    	//Act
    	Test.startTest();
    	for(Case singleMaintRequest : allMaintRequests){
    		singleMaintRequest.status = 'Closed';
    	}
    	update allMaintRequests;
    	Test.stopTest();			
    	
    	//Assert
    	//List<Case> allCases = [SELECT ID,Date_Due__c FROM Case WHERE Vehicle__c =: singleVehicle.Id and status = 'New'];
    	List<Case> allCases = [SELECT ID,Date_Due__c FROM Case WHERE status = 'New'];
    	System.assertEquals(201,allCases.size());	
    	
    }

Below is the error message I am getting -
System.DmlException: Update failed. First exception on row 200 with id 50036000003SeKQAA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MaintenanceRequest: execution of AfterUpdate

caused by: System.DmlException: Insert failed. First exception on row 0 with id 50036000003SeKRAA0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]

Class.MaintenanceRequestHelper.createFollowUpMaintenanceRequest: line 54, column 1
Class.MaintenanceRequestHelper.updateAfterUpdateActivity: line 16, column 1
Trigger.MaintenanceRequest: line 3, column 1: []

Strange thing is that if I test with 200 Maintenance Requests, test method is getting passed, but the moment I make it 201, it started failing. Any idea why this is behaving like this?

Hi,

 

I have built a visualforce page which decodes a base64 string from text back into an image and want a button to export the results into a PDF.

 

Trialing with the concept of making it render direct to a PDF did not work as it was not showing the images in the PDF.

 

Could anyone please direct me to how I can create an export to pdf option which retains images?

I need to rewrite the view filter control to handle our  product list.

 

so I want so do this with a tree control, with cascading checkbox,

 

expand a branch, select a sub-branch(selects all children), expand a sub branch and de-select one element or deeper sub branch. (delesects all children)..

 

I see need for tree, but don't see a solution..

 

is this a flash tool?

 

Sam