• Princy
  • NEWBIE
  • 80 Points
  • Member since 2014
  • Salesforce Developer


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 7
    Replies
Currently my name is made up as follows

1. London, Royal Opera Hous

i would like to show the account name only as 

London (i.e. without "1." and without the second part after comma)

All this i also would like to be able to use as a hyperlink so that when i click on it, i am redirected to the relevant account

Please help, currently i only got to 

Data TypeFormula  
LEFT(Account.Name, FIND( ",", Account.Name ) -1 )

which eliminates the second part however, i cannot remove the "1." and also cannot make it work as a link

MANY thanks

Hello

I have this class that is making the request body for an integration with netsuite. 
 

public class netsuite_CustomerMap implements INetsuiteMap{

	public map<string, object>  getNSMap(SObject sobj) {

		Account acc = (Account)sobj;
        string objectName = acc.getSObjectType().getDescribe().getName();
        netsuite_Service nsService = new netsuite_Service();
        map<string,map<string, Netsuite_Mapping__mdt>> ns_Map = nsService.getNSDefaultMap();
		map<string, object> objMap = new map<string, object>();

		objMap.put('companyname',acc.Name);
		objMap.put('externalid', acc.Id);
		objMap.put('recordtype', ns_Map.get('recordtype').get(objectName).Netsuite_Value__c);
		objMap.put('altPhone',acc.Phone);
		objMap.put('currency', ns_Map.get('currency').get(acc.CurrencyIsoCode).Netsuite_Value__c);
		objMap.put('customForm', ns_Map.get('customForm').get(objectName).Netsuite_Value__c);
		objMap.put('phone', acc.phone);
		objMap.put('isPerson', ns_Map.get('isPerson').get(objectName).Netsuite_Value__c);
		objMap.put('entityStatus',ns_Map.get('entityStatus').get(objectName).Netsuite_Value__c);*/

		
		return objMap;

	}
}

It works nicely but then I started thinking about what would happen if that request body needed to be changed. Perhaps a new field becsomes required by Netsuite, for example. This would require me to make edits to the class and deploying. So, I thought maybe I could put these map definitions into custom metadata, which would allow me to make any required changes by editing custom metdata inside production. I wound up with the following class:
 
public class netsuite_CustomerMap implements INetsuiteMap{

	public map<string, object>  getNSMap(SObject sobj) {

		Account acc = (Account)sobj;
        string objectName = acc.getSObjectType().getDescribe().getName();
        netsuite_Service nsService = new netsuite_Service();
        map<string,map<string, Netsuite_Mapping__mdt>> ns_Map = nsService.getNSDefaultMap();
		map<string, object> objMap = new map<string, object>();

		

		for(Netsuite_Master_Map_Definition__mdt mapSource : [select Id, 
																	 
 MasterLabel, 
																	Netsuite_Master_Map__c, 
																	Netsuite_Master_Map__r.MasterLabel, 
																	Netsuite_Field__c,  
																	Salesforce_Value__c 
															from Netsuite_Master_Map_Definition__mdt 
															where Netsuite_Master_Map__r.Apex_Class_Name__c = 'netsuite_CustomerMap']) {
			objMap.put(mapSource.Netsuite_Field__c, mapSource.Salesforce_Value__c);													
		}

		return objMap;

	}
}


And here is an example of what the 2 custom fields in Netsuite_Master_Map_Definition__mdt called Netsuite_Field__c and Salesforce_Value__c are storing:

Netsuite_Field__c = 'companyname'

Salesforce_Value__c = acc.Name

As an admin, what I didn't think through is that this would not work because these are text fields and therefore simply populates the objMap with literal text values like so "'companyname'" => "acc.Name".

So, at this point I'm not sure what to do and will probably just reconcile myself to the reality of updating the class anytime a change to request body is needed.....Unless someone out there has any good ideas.

Thanks!

 

Hey guys!!
Anyone there completed this challenge?
I've tried a number of ways and finally succeeded by writing the folloeing code:

campingListItem.cmp:

<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true" />
    <aura:attribute name="disabled1" type="Boolean" default="false" />
    <p><ui:inputCheckbox value="{!v.item.Packed__c}"/></p>
    <ui:button label="Packed!" press="{!c.packItem}" disabled="{!v.disabled1}"/>
</aura:component>

campingListController.js

({
    packItem : function(component, event, helper) {
        component.set("v.item.Packed__c",true);
        component.set("v.disabled1", true);
    }
})
It's working fine on my browser but on checking challenge, I get:
Challenge Not yet complete... here's what's wrong:
The campingListItem JavaScript controller isn't disabling the button correctly.

Can't understand what's going wrong. Also tried by other ways like:
component.set(true, event.getSource().get("v.disbaled"));
OR
component.set(event.getSource().get("v.disbaled"), true);
ETC..
None of them seems to be working fine.
 
Hi, 
Is there a way I can easily find a specific picklist value used in number of classes or workflow, or anywhere in the matadata? 

For example: case status -  Pending ==> I want to deactivte this value or alter the label to say Pending Input. 

How do I find out where is this value is used or listed without having to go through workflow and apex code one at a time? 

Is this possible with Eclipse? If so, can you provide the steps please? If not, is there a free tool I can use? I would truely appreciate any help. 
Hi, 

  Code coverage for below class is 90% in sandbox. 
public class LeadTriggerUtils {
    
    public static void processLeadOnUpdate(Map<id, Lead> newMap, Map<id, Lead> oldMap) { 
        List<Lead> leadLst = new List<Lead>();
        for (Lead lead : newMap.values()) {
            Lead oldLead = oldMap.get(lead.id);
            if(lead.rvpe__IsDealRegistration__c && lead.rvpe__RVAccount__c != null && lead.rvpe__RVAccount__c != oldLead.rvpe__RVAccount__c) {
        leadLst.add(lead);
            }
        }
        if(!leadLst.isEmpty()) {
      processChangeOwnerAsPartnerAccount(leadLst); 
        }
    }
    
    public static void processLeadOnInsert(List<Lead> newLst) {
      processChangeOwnerAsPartnerAccount(newLst);
    }
    public static void processChangeOwnerAsPartnerAccount(List<Lead> newLst) {
        List<ID> rvAcctIDs = new List<ID>();
        for(Lead lead : newLst) {
            if(lead.rvpe__IsDealRegistration__c && (lead.Global_Region__c == 'EMEA' || lead.Global_Region__c == 'LATAM') && lead.rvpe__RVAccount__c != null) {
                rvAcctIds.add(lead.rvpe__RVAccount__c);
            }
        }
        Map<ID, rvpe__RVAccount__c> rvActMap = new Map<Id, rvpe__RVAccount__c>([select id, rvpe__SFAccount__c, rvpe__SFAccount__r.OwnerId from rvpe__RVAccount__c where id in :rvAcctIDs]);
        for(Lead lead : newLst) {
            rvpe__RVAccount__c rvAct = rvActMap.get(lead.rvpe__RVAccount__c);
            if(rvAct != null && rvAct.rvpe__SFAccount__c != null) {
                lead.OwnerId = rvAct.rvpe__SFAccount__r.OwnerId;
            }
        }
    }
}

Test Class
@isTest(seealldata=true)
public class LeadTriggerUtilsTest
{
    
    public static testMethod void Method1(){
        
           
          rvpe__RVAccount__c rpv = [select id from rvpe__RVAccount__c where rvpe__SFAccount__c <> null and rvpe__PartnerLevel__c = 'NA Reseller' limit 1];
          rvpe__RVAccount__c rpv2 = [select id from rvpe__RVAccount__c where rvpe__SFAccount__c <> null and rvpe__PartnerLevel__c = 'NA Reseller' limit 1];
          
            Lead l1 = new Lead();
            l1.FirstName = 'Pranavan';
            l1.LastName = 'Karthi';
            l1.Email = 'karthi@pranavan.com';
            l1.Company = 'Pranavan';
            l1.country = 'United States';
            l1.rvpe__IsDealRegistration__c = true;
            l1.Global_Region__c = 'EMEA'; 
            l1.rvpe__RVAccount__c = rpv.id;
            
            insert l1;
            
            l1.FirstName = 'Velu';
            l1.rvpe__RVAccount__c = rpv2.id;
            
            update l1;
            
       }
}

When I try to validate the change set in production it shows 0% code coverage. Please suggest me what is the issue here in test class

Thanks
Sudhir​​​​​​​
  • April 09, 2019
  • Like
  • 0
Currently my name is made up as follows

1. London, Royal Opera Hous

i would like to show the account name only as 

London (i.e. without "1." and without the second part after comma)

All this i also would like to be able to use as a hyperlink so that when i click on it, i am redirected to the relevant account

Please help, currently i only got to 

Data TypeFormula  
LEFT(Account.Name, FIND( ",", Account.Name ) -1 )

which eliminates the second part however, i cannot remove the "1." and also cannot make it work as a link

MANY thanks

Hello

I have this class that is making the request body for an integration with netsuite. 
 

public class netsuite_CustomerMap implements INetsuiteMap{

	public map<string, object>  getNSMap(SObject sobj) {

		Account acc = (Account)sobj;
        string objectName = acc.getSObjectType().getDescribe().getName();
        netsuite_Service nsService = new netsuite_Service();
        map<string,map<string, Netsuite_Mapping__mdt>> ns_Map = nsService.getNSDefaultMap();
		map<string, object> objMap = new map<string, object>();

		objMap.put('companyname',acc.Name);
		objMap.put('externalid', acc.Id);
		objMap.put('recordtype', ns_Map.get('recordtype').get(objectName).Netsuite_Value__c);
		objMap.put('altPhone',acc.Phone);
		objMap.put('currency', ns_Map.get('currency').get(acc.CurrencyIsoCode).Netsuite_Value__c);
		objMap.put('customForm', ns_Map.get('customForm').get(objectName).Netsuite_Value__c);
		objMap.put('phone', acc.phone);
		objMap.put('isPerson', ns_Map.get('isPerson').get(objectName).Netsuite_Value__c);
		objMap.put('entityStatus',ns_Map.get('entityStatus').get(objectName).Netsuite_Value__c);*/

		
		return objMap;

	}
}

It works nicely but then I started thinking about what would happen if that request body needed to be changed. Perhaps a new field becsomes required by Netsuite, for example. This would require me to make edits to the class and deploying. So, I thought maybe I could put these map definitions into custom metadata, which would allow me to make any required changes by editing custom metdata inside production. I wound up with the following class:
 
public class netsuite_CustomerMap implements INetsuiteMap{

	public map<string, object>  getNSMap(SObject sobj) {

		Account acc = (Account)sobj;
        string objectName = acc.getSObjectType().getDescribe().getName();
        netsuite_Service nsService = new netsuite_Service();
        map<string,map<string, Netsuite_Mapping__mdt>> ns_Map = nsService.getNSDefaultMap();
		map<string, object> objMap = new map<string, object>();

		

		for(Netsuite_Master_Map_Definition__mdt mapSource : [select Id, 
																	 
 MasterLabel, 
																	Netsuite_Master_Map__c, 
																	Netsuite_Master_Map__r.MasterLabel, 
																	Netsuite_Field__c,  
																	Salesforce_Value__c 
															from Netsuite_Master_Map_Definition__mdt 
															where Netsuite_Master_Map__r.Apex_Class_Name__c = 'netsuite_CustomerMap']) {
			objMap.put(mapSource.Netsuite_Field__c, mapSource.Salesforce_Value__c);													
		}

		return objMap;

	}
}


And here is an example of what the 2 custom fields in Netsuite_Master_Map_Definition__mdt called Netsuite_Field__c and Salesforce_Value__c are storing:

Netsuite_Field__c = 'companyname'

Salesforce_Value__c = acc.Name

As an admin, what I didn't think through is that this would not work because these are text fields and therefore simply populates the objMap with literal text values like so "'companyname'" => "acc.Name".

So, at this point I'm not sure what to do and will probably just reconcile myself to the reality of updating the class anytime a change to request body is needed.....Unless someone out there has any good ideas.

Thanks!

 

Hey guys!!
Anyone there completed this challenge?
I've tried a number of ways and finally succeeded by writing the folloeing code:

campingListItem.cmp:

<aura:component >
    <aura:attribute name="item" type="Camping_Item__c" required="true" />
    <aura:attribute name="disabled1" type="Boolean" default="false" />
    <p><ui:inputCheckbox value="{!v.item.Packed__c}"/></p>
    <ui:button label="Packed!" press="{!c.packItem}" disabled="{!v.disabled1}"/>
</aura:component>

campingListController.js

({
    packItem : function(component, event, helper) {
        component.set("v.item.Packed__c",true);
        component.set("v.disabled1", true);
    }
})
It's working fine on my browser but on checking challenge, I get:
Challenge Not yet complete... here's what's wrong:
The campingListItem JavaScript controller isn't disabling the button correctly.

Can't understand what's going wrong. Also tried by other ways like:
component.set(true, event.getSource().get("v.disbaled"));
OR
component.set(event.getSource().get("v.disbaled"), true);
ETC..
None of them seems to be working fine.
 
Challenge Not yet complete... here's what's wrong: 
Inserting a new Maintenance Request of type 'Routine Maintenance' and then closing it did not create of a new Maintenance Request based upon the original record correctly. The challenge is expecting to find the closed Maintenance Request plus an 'New' Maintenance Request of type 'Routine Maintenance' with the same Vehicle as the closed one.