• Ghanshyam Kumar 9
  • NEWBIE
  • 125 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

I am trying to deploy customLabels to the production org. But, I am not able to deploy it as it asks to run the test classes. As we know the custom label is just the configurations, not the codes. So, we don't need to run the test classes. My production org is a very new org and it doesn't have any class or test class till now.
Please help me to fix this problem. Thanks in Advance!!!

My package.xml contains the following value only.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>
        <members>*</members>
        <name>CustomLabel</name>
    </types>

    <version>47.0</version>
</Package>


I am using the following command to deploy it.
sfdx force:source:deploy --checkonly -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests


When I run this command, it successfully validates the deployment and generates the JobId. When I run the next command to deploy it gives an error - "INVALID_ID_FIELD: Source validate did not run tests in the org".


sfdx force:source:deploy --targetusername myProdUserName --validateddeployrequestid JobId


For all these operations, I am referring to this link of the salesforce. https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_build_mdapi_production.htm
I took some help from this link as well. https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm

I am not able to use nested aura:iteration in my lightning component. Please see my lightning component code below. But, I am able to use the nested array directly by using indexing which you can see in 3rd line code.
<aura:iteration items="{!v.CoursesDetailsWithOfferings}" var="courseDetail">                 
<li id="{!courseDetail.courseName}">{!courseDetail.courseName}</li>
<span>{!courseDetail.courseOfferings[0].Campus_Location__c}</span>
    <aura:iteration items="{!courseDetail.courseOfferings}" var="courseOffering">
        <span id="{!courseOffering.Campus_Location__c}">{!courseOffering.Campus_Location__c}</span>
    </aura:iteration>
</aura:iteration>
Please check my JSON data which I am getting in the helper.
CoursesDetailsWithOfferings - It contains the following array.

[{courseName: "BCA", courseOfferings:[{Campus_Location__c:"Delhi",Name: "Test1", Start_Date__c: "2017-10-03", End_Date__c: "2019-10-02"}]}, {courseName: "MCA", courseOfferings:[{Campus_Location__c:"Goa",Name: "Test2", Start_Date__c: "2017-11-03", End_Date__c: "2019-11-02"}]}]

Please help me to fix it. Thanks in advance!!!!!
We have a requirement where we are encrypting Salesforce ID value using Crypto class method. Crypto.encryptWithManagedIV('AES128', key, data);

But it generates a key which contains + sign and when we read this value in apex we get space for that + sign.

We tried EncodingUtil.urlDecode and EncodingUtil.urlEncode. In that case + sign is getting converted into %2B and again we get space for that in the apex.

For Ex -

Encoded value in URL gAbH0FIEK5l2m8wVKTV+p4R5QLay2D9jZ2BgsyQ3mJ1/9puMMIne6y5P6i3ZRidl

Encoded value in Apex

gAbH0FIEK5l2m8wVKTV p4R5QLay2D9jZ2BgsyQ3mJ1/9puMMIne6y5P6i3ZRidl

can someone please suggest how to handle the situation?

We can handle spaces by replacing it with + sign. But I am not sure if it will throw an error for any specific characters/case.

I am trying to deploy customLabels to the production org. But, I am not able to deploy it as it asks to run the test classes. As we know the custom label is just the configurations, not the codes. So, we don't need to run the test classes. My production org is a very new org and it doesn't have any class or test class till now.
Please help me to fix this problem. Thanks in Advance!!!

My package.xml contains the following value only.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>
        <members>*</members>
        <name>CustomLabel</name>
    </types>

    <version>47.0</version>
</Package>


I am using the following command to deploy it.
sfdx force:source:deploy --checkonly -x ./manifest/package.xml -u myProdUserName --testlevel RunLocalTests


When I run this command, it successfully validates the deployment and generates the JobId. When I run the next command to deploy it gives an error - "INVALID_ID_FIELD: Source validate did not run tests in the org".


sfdx force:source:deploy --targetusername myProdUserName --validateddeployrequestid JobId


For all these operations, I am referring to this link of the salesforce. https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_build_mdapi_production.htm
I took some help from this link as well. https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_source.htm

For the Challenge1 of 'Create Secure Lightning Components Module', I identified 2 vulnerabilities and removed in the code (as shown in screenshot. However, still I am getting the error "The 'LTNG_Secure_Component_Challenge' component is not yet secured. Remember, unescapedHTML is dangerous. ui:outputRichText is a safer alternative.". I have already replaced unescapedHtml tag with ui:outputRichText. Do anyone come across this?

User-added image
I've been working on this trail for a bit - and while I undertsand the concepts, I'm stumped on why I'm getting this error: 
 
Challenge Not yet complete... here's what's wrong: 
A Create a Record action for the Closed Won criteria node isn't properly configured. Make sure that it creates a draft contract according to the instructions in the ‘Create contract for closed opportunity’ task action. Make sure that Start Date is set by using a formula.

I've gone over all of the workflow tasks information to recreate the contact. If I activate the process and close an opportunity, it creates a contract with the expected information and the date is 1mo away with 12mo term. The workflow's task (which is the template for the actual contract) specifies the following: 
 
Use the closed opportunity to create a contract for the associated account. 

Account: The account associated with this opportunity
Status: Draft
Contract Start Date: 1 month from today
Contract Term: 12
Here are my actions: 
User-added image

The Contract Start Date is set to the following formula:
DATE(
    YEAR(Today()) +
    FLOOR((1 + MONTH(Today())) / 12) -
    IF (MOD(MONTH(Today()) + 1, 12) = 0,
        1,
        0),

    MOD((1 + MONTH(Today()) - 1), 12) + 1,

    DAY(Today())
)

Again, for all practical purposes I'm passing this, as it functions and the contract is created. But I must be missing some small detail, named field, something that's tripping up the validation settings. Any help is appreciated!

 
I'm currently stuck on the "Learn Standard Open Redirect Preventions" challenge of the "App Logic Vulnerability Prevention" module.

The challenge is to submit a valid open redirect attack starting from the Standard Redirect Protections Challenge tab.

However, the links on this page are all to standard record pages, where the hack (e.g changing retURL to returl) won't work (it only works on VF pages).

Even if I attempt this and check the challenge, the error I get states: "It doesn't appear that you've successfully redirected to an external website using the Visualforce page. Please try again." - so it implies that it expects me executing this from a custom VF page.

Can anyone give me some advice on where I'm missing something on the challenge?
Hello,

I am trying to complete the challenge for the Use Org & Session Cache module on Salesforce Trailhead. Here are the instructions:

In this challenge, you’ll write an Apex class that writes and reads a bus schedule from the org cache. Your method for reading the cache has to handle cache misses.
  • Create a partition called BusSchedule with 0 MB for the size of org cache and session cache. The 0 MB allocation enables you to test cache misses.
  • Create a public Apex class called BusScheduleCache.
  • Add this variable to the class: private Cache.OrgPartition part;
  • In the constructor, create a new instance of Cache.OrgPartition by passing it the partition name (local.BusSchedule). Assign this object to the class variable (part).
  • Add two public methods. a. The first method, putSchedule(), returns void and takes these parameters: String busLine, Time[] schedule. b. The second method, getSchedule(), returns a bus schedule as a time array (Time[]) and takes this parameter: String busLine.
  • Implement the putSchedule() method so that it stores the passed-in values in the org cache by using the partition class variable (part).
  • Implement the getSchedule() method so that it returns the schedule for the specified bus line by using the partition class variable (part).
  • Add logic to the getSchedule() method to handle cache misses. If null is returned for the cached value, getSchedule() should return the following default schedule as a Time array with two Time objects: one Time object value of 8am and another of 5pm. Use the Apex Time.newInstance() method to create the Time objects.
Here is my current code:
 
public class BusScheduleCache {   
    // Get partition
    private Cache.OrgPartition part;
    String partitionName = 'local.BusSchedule';
    
    public BusScheduleCache(String partitionName) {
		Cache.OrgPartition newpart = Cache.Org.getPartition(partitionName);
        part = newpart;
    }
    
    public static void putSchedule(String busLine, Time[] schedule) {
        Cache.Org.put(busline, schedule);
    }
        
    public static Time[] getSchedule(String busLine) {
        Time[] schedule;
        
        // Get a cached value
		Object obj = Cache.Org.get(busLine);
		// Cast return value to a specific data type
		Time t2 = (Time)obj;
        if (t2 != null) {
        	schedule.add(t2);
        }
        else {
            Time t3 = Time.newInstance(8,0,0,0);
            schedule.add(t3);
            Time t4 = Time.newInstance(17,0,0,0);
            schedule.add(t4);
        }        
        return schedule;
    }  
      
}



Here is the error I am receiving:

Challenge Not yet complete... here's what's wrong: 
The Apex Class BusScheduleCache is not properly implemented. Please follow the requirements and ensure everything is setup correctly

Can someone please help?
I have a scenario where I am trying to run a method as a portal user and that method inturn creates a new account but when I try to do the same I am getting the below error can some one please help me.

System.DmlException: Insert failed. First exception on row 0; first error: OP_WITH_INVALID_USER_TYPE_EXCEPTION, Operation not valid for this user type: []

I created a public site and enable it for customer community login. When I login as a community user, I need to create an Account record. But everytime when I try to create an Account record as a community user, I get the error message saying "OP_WITH_INVALID_USER_TYPE_EXCEPTION, Operation not valid for this user type: []". I rememebered that there is no problem to create Account records with customer portal or partner portal, even if the customer portal doesn't have create permission, since we already run the apex class in system admin mode. But why we can't do that with community user? Did anybody encounter the same problem or know how to solve this problem? Any suggestions will be helpful. Thanks in advance!!

I'm having issue in escaping a single quote in VisualForce page.

In my output label, I used

{!IF($Profile.Name=="Customer Portal User","My Open Service Requests","Company\'s Open Service Requests")}

 

The output on my VF page is Company\'s Open Service Requests. Its not escaping the single quote. 

 

I also tried "Company\'\'s Open Service Requests".

 

Thanks in advance for the help.

  • October 04, 2012
  • Like
  • 0