• Arpit Jain92
  • NEWBIE
  • 70 Points
  • Member since 2015
  • Salesforce Developer


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 23
    Replies
Hello Everyone,

I am using an lwc component on which users will upload a file and they can also preview that. For a preview, I am using navigationMixin and navigate the record to standard_namedPage which working fine for internal use but the same method is not working in the community. I am not able to preview the file using that. Today I did some research and get to know standard_namedPage not supported community and for that, I need to use standard_webPage which redirects me to the new tab and I can see my file there but the issue is on that new tab I can see my file as a thumbnail, not the actual file. Can someone guide me on how can I preview files in the community as the original file?
Below is the code that I am using for both internal and external.
 
Internal:
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'filePreview'
},
state : {
// assigning ContentDocumentId to show the preview of file
selectedRecordId:event.currentTarget.dataset.id
}
})

External:
//Getting content version id to assign the url.
contentVersionId = response;
var baseURL = 'https://'+location.host+'/';
var previewURL = baseURL + 'sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+contentVersionId;
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: previewURL
}
}, false );

Thanks,
Arpit Jain
Hello All,

I am facing a below-mentioned error while uploading code from VS code to my developer code. I didn't change anything code I am using as it is given in trailhead.

Error:
=== Deploy Errors
PROJECT PATH                                 ERRORS                                                     
───────────────────────────────────────────  ───────────────────────────────────────────────────────────
force-app\main\default\lwc\detail\detail.js  No MODULE named markup://c:data found : [markup://c:detail]


CODE:
data.js:

export const bikes = [
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1arAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-12T02:57:48.000Z"},"Level__c":{"displayValue":"Racer","value":"Racer"},"MSRP__c":{"displayValue":"$7,800","value":7800},"Material__c":{"displayValue":"Carbon","value":"Carbon"},"Name":{"displayValue":null,"value":"DYNAMO X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-12T02:57:48.000Z"}},"id":"a0256000001F1arAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-12T02:57:48.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-12T02:57:48.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1atAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-10T17:26:47.000Z"},"Level__c":{"displayValue":"Racer","value":"Racer"},"MSRP__c":{"displayValue":"$6,802","value":6802},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X2"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox2.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-10T17:26:47.000Z"}},"id":"a0256000001F1atAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-10T17:26:47.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-10T17:26:47.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1auAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T04:37:56.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$5,601","value":5601},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X3"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox3.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T04:37:56.000Z"}},"id":"a0256000001F1auAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T04:37:56.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T04:37:56.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1avAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$5,500","value":5500},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X4"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox4.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1avAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1azAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$4,600","value":4600},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"FUSE X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/fusex1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1azAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b2AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T04:41:56.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$3,200","value":3200},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T04:41:56.000Z"}},"id":"a0256000001F1b2AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T04:41:56.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T04:41:56.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b3AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$3,200","value":3200},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X2"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax2.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b3AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b6AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$2,700","value":2700},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X3"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax3.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b6AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b7AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$2,700","value":2700},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X4"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b7AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"}
];

Detail.js is the file in which I am using data.js
import { LightningElement, api } from 'lwc';
import { bikes } from 'c/data';
export default class Detail extends LightningElement {
    //bikes = bikes;
    product;
    // Private var to track @api productId
    _productId = undefined;
    // Use set and get to process the value every time it's
    // requested while switching between products
    set productId(value) {
        this._productId = value;
        this.product = bikes.find(bike => bike.fields.Id.value === value);
    }
    
    // getter for productId
    @api get productId(){
        return this._productId;
    }
}


Could you please help me why I am getting this error. Even if I remove import { bikes } from 'c/data'; this line it works fine but I don't know why it's not working with that.

Please guide me.

Thanks,
Arpit
 
Hello All,

I am trying to complete a one of the task in Trailhead name if that is "Create a Unique Account List View" and I followed all the steps and everytime I getting error Industy type is not found but I already selected Industry still I am getting the same error and now I got this
"There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: JBBBXJJJ" even I tried to do this task in developer org and three other trailhead playground but it doesn't work.
Please help me out guys.

Thank You
Arpit.
Hi,

I am creating a vf page on which i need to show account,opportunity and opportunity contact role with a checkbox and a custom button(Clone). I need to clone all the selected records after click on this button.

I am new to Salesforce and have worked on this functionality for a long time. I would really appreciate your help on this functionaly. 
 
Hi,

I am writing a test class for a trigger, in that test class when I am getting this error when I write my login in system.runas method but when I write same login in another function it will work. "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, The formula in the "Room Certification Expiry Date" rule or process is invalid due to the following:<br/>Error evaluating formula field for time trigger date:  Room Certification: Expiry Date: " Please tell what is the issue.

Here is the code of Trigeer and test class-

Trigger:-
trigger RG_RoomCertificationExpiryDateUpdate on Room_Certification__c  (After insert,before update)
{    
List<Room_Certification__c > roomCertificationList=[select id,name,Certification_Date__c,Visit__r.Study__r.Study_Certificate_Duration__c from Room_Certification__c where id In:trigger.newMap.keySet()];
 
   if(Trigger.IsUpdate)
   {
    for(Room_Certification__c roomCert:roomCertificationList)
    {
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c=='Duration of Study')
        {
                trigger.newMap.get(roomCert.id).CertificationExpiryDate_String__c='Duration of Study';
        }
        
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!='Duration of Study' && roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!=null )
        {
                string monthh=roomCert.Visit__r.Study__r.Study_Certificate_Duration__c.removeEnd('m');
                system.debug('@@month'+monthh);
                Date dt=(trigger.newMap.get(roomCert.id).Certification_Date__c.AddMonths(Integer.ValueOf(monthh)))-1;
                system.debug('@@CalculatedDate'+dt);
                trigger.newMap.get(roomCert.id).CertificationExpiryDate_String__c=dt.format();
        }
    }
    }
    //After insert
    if(Trigger.IsInsert)
   {
    List<Room_Certification__c> exCertiChildUpdate=new List<Room_Certification__c>();
    for(Room_Certification__c roomCert:roomCertificationList)
    {
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c=='Duration of Study')
        {
                roomCert.CertificationExpiryDate_String__c='Duration of Study';
                exCertiChildUpdate.add(roomCert);
        }
        
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!='Duration of Study' && roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!=null )
        {
                string monthh=roomCert.Visit__r.Study__r.Study_Certificate_Duration__c.removeEnd('m');
                system.debug('@@month'+monthh);
                Date dt=(trigger.newMap.get(roomCert.id).Certification_Date__c.AddMonths(Integer.ValueOf(monthh)))-1;
                system.debug('@@CalculatedDate'+dt);
                roomCert.CertificationExpiryDate_String__c=dt.format();
                exCertiChildUpdate.add(roomCert);
        }
    }
    if (exCertiChildUpdate.isEmpty() == false)
    {
        Database.update(exCertiChildUpdate);
    }
    }
}
Test Class:-
@isTest
public class RG_RoomCertificationExpiryDate_Test
{
    public static testmethod void main()
    {
        //Client Create
        Account acc= new Account(Name='Test');
        insert acc;
        //Study Create
        Study__c study= new Study__c(Client__c=acc.id,Name='Testing',NumberofExaminerCertificationRounds__c=2,PONumber__c='123456',Study_Certificate_Duration__c='Duration of Study');
        insert study;
        //Site Create
        Site__c site= new Site__c(Name='Testing Site',Zip_Postal_Code__c='301001',City__c='Delhi');
        insert site;
        //Visit Create
        Visit__c Visit= new Visit__c(Study__c=study.id,Round__c=2,VisitType__c='Visit',VisitStatus__c='Contacted',SiteC__c=site.id,Study_Specific_Site_Number__c='123456');
        insert Visit;
        //Room Create
        Room__c Room= new Room__c(Room_Name__c='Test',SiteC__c=site.Id);
        insert Room;
        //Room Certification Create
        Room_Certification__c Rc= new Room_Certification__c(Room__c=Room.Id,Status__c='certified',Room_Certification_Round__c=2,Certification_Date__c=Date.Today(),VisitSite__c=site.id,Visit__c=Visit.Id);
        Insert Rc;
        study.Study_Certificate_Duration__c='6m';
        update study;
    }
    public static testmethod void main1()
    {
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
        EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',LocaleSidKey='en_US',ProfileId=p.Id,
        TimeZoneSidKey='America/Los_Angeles', UserName='Testingapexclass@gmail.com');
        system.RunAs(u)
        {
            //Client Create
            Account acc= new Account(Name='Test');
            insert acc;
            //Study Create
            Study__c study= new Study__c(Client__c=acc.id,Name='Testing',NumberofExaminerCertificationRounds__c=2,PONumber__c='123456',Study_Certificate_Duration__c='Duration of Study');
            insert study;
            //Site Create
            Site__c site= new Site__c(Name='Testing Site',Zip_Postal_Code__c='301001',City__c='Delhi');
            insert site;
            //Visit Create
            Visit__c Visit= new Visit__c(Study__c=study.id,Round__c=2,VisitType__c='Visit',VisitStatus__c='Contacted',SiteC__c=site.id,Study_Specific_Site_Number__c='123456');
            insert Visit;
            //Room Create
            Room__c Room= new Room__c(Room_Name__c='Test',SiteC__c=site.Id);
            insert Room;
            //Room Certification Create
            Room_Certification__c Rc= new Room_Certification__c(Room__c=Room.Id,Status__c='certified',Room_Certification_Round__c=2,Certification_Date__c=Date.Today(),VisitSite__c=site.id,Visit__c=Visit.Id);
            Insert Rc;
        }
    }
}
Hello,

I have a custom field on account, I want to updated that field with the latest contact name using trigger and the name of the contact is same as account name with some other values. like Account name is-ABC then contact name will be like ABC1, ABC2, ABC3. Pls help me out.

Thank You.
Arpit
Hello Guys,

After assigning any record to create for custom didn't get email, but when I tried to manually add a record to queue I got email..Why??

Thank You.
Arpit
Hi All,

Why a custom is not deleted that was in relationship?

Regards,
Arpit
Hi All,
Can we use one object in two applications?

Arpit Jain
Hello Everyone,
I am stuck here...Please tell me how to create a validation rule for this and can anyone explain this question.

To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).
1. Name the validation rule 'Contact must be in Account ZIP Code'.
2. A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
3. The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)
Hello Everyone,

I reset one my user password but I didn't get any email via password. So pleae tell me how I can get the password?
I sthere anything else which I need to do for getting password??

Thank you.
Hello Everyone,

I am using an lwc component on which users will upload a file and they can also preview that. For a preview, I am using navigationMixin and navigate the record to standard_namedPage which working fine for internal use but the same method is not working in the community. I am not able to preview the file using that. Today I did some research and get to know standard_namedPage not supported community and for that, I need to use standard_webPage which redirects me to the new tab and I can see my file there but the issue is on that new tab I can see my file as a thumbnail, not the actual file. Can someone guide me on how can I preview files in the community as the original file?
Below is the code that I am using for both internal and external.
 
Internal:
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'filePreview'
},
state : {
// assigning ContentDocumentId to show the preview of file
selectedRecordId:event.currentTarget.dataset.id
}
})

External:
//Getting content version id to assign the url.
contentVersionId = response;
var baseURL = 'https://'+location.host+'/';
var previewURL = baseURL + 'sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+contentVersionId;
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: previewURL
}
}, false );

Thanks,
Arpit Jain
Hello All,

I am facing a below-mentioned error while uploading code from VS code to my developer code. I didn't change anything code I am using as it is given in trailhead.

Error:
=== Deploy Errors
PROJECT PATH                                 ERRORS                                                     
───────────────────────────────────────────  ───────────────────────────────────────────────────────────
force-app\main\default\lwc\detail\detail.js  No MODULE named markup://c:data found : [markup://c:detail]


CODE:
data.js:

export const bikes = [
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1arAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-12T02:57:48.000Z"},"Level__c":{"displayValue":"Racer","value":"Racer"},"MSRP__c":{"displayValue":"$7,800","value":7800},"Material__c":{"displayValue":"Carbon","value":"Carbon"},"Name":{"displayValue":null,"value":"DYNAMO X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-12T02:57:48.000Z"}},"id":"a0256000001F1arAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-12T02:57:48.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-12T02:57:48.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1atAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-10T17:26:47.000Z"},"Level__c":{"displayValue":"Racer","value":"Racer"},"MSRP__c":{"displayValue":"$6,802","value":6802},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X2"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox2.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-10T17:26:47.000Z"}},"id":"a0256000001F1atAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-10T17:26:47.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-10T17:26:47.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1auAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T04:37:56.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$5,601","value":5601},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X3"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox3.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T04:37:56.000Z"}},"id":"a0256000001F1auAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T04:37:56.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T04:37:56.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1avAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$5,500","value":5500},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"DYNAMO X4"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/dynamox4.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1avAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Mountain","value":"Mountain"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1azAAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Enthusiast","value":"Enthusiast"},"MSRP__c":{"displayValue":"$4,600","value":4600},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"FUSE X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/fusex1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1azAAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b2AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T04:41:56.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$3,200","value":3200},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X1"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax1.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T04:41:56.000Z"}},"id":"a0256000001F1b2AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T04:41:56.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T04:41:56.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b3AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$3,200","value":3200},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X2"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax2.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b3AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b6AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$2,700","value":2700},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X3"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax3.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b6AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"},
    {"apiName":"Product__c","childRelationships":{},"fields":{"Category__c":{"displayValue":"Commuter","value":"Commuter"},"CreatedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Description__c":{"displayValue":null,"value":"A durable e-bike with great looks."},"Id":{"displayValue":null,"value":"a0256000001F1b7AAC"},"LastModifiedDate":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"},"Level__c":{"displayValue":"Beginner","value":"Beginner"},"MSRP__c":{"displayValue":"$2,700","value":2700},"Material__c":{"displayValue":"Aluminum","value":"Aluminum"},"Name":{"displayValue":null,"value":"ELECTRA X4"},"Picture_URL__c":{"displayValue":null,"value":"https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg"},"SystemModstamp":{"displayValue":null,"value":"2018-10-09T03:29:52.000Z"}},"id":"a0256000001F1b7AAC","lastModifiedById":null,"lastModifiedDate":"2018-10-09T03:29:52.000Z","recordTypeInfo":null,"systemModstamp":"2018-10-09T03:29:52.000Z"}
];

Detail.js is the file in which I am using data.js
import { LightningElement, api } from 'lwc';
import { bikes } from 'c/data';
export default class Detail extends LightningElement {
    //bikes = bikes;
    product;
    // Private var to track @api productId
    _productId = undefined;
    // Use set and get to process the value every time it's
    // requested while switching between products
    set productId(value) {
        this._productId = value;
        this.product = bikes.find(bike => bike.fields.Id.value === value);
    }
    
    // getter for productId
    @api get productId(){
        return this._productId;
    }
}


Could you please help me why I am getting this error. Even if I remove import { bikes } from 'c/data'; this line it works fine but I don't know why it's not working with that.

Please guide me.

Thanks,
Arpit
 
Hello All,

I am trying to complete a one of the task in Trailhead name if that is "Create a Unique Account List View" and I followed all the steps and everytime I getting error Industy type is not found but I already selected Industry still I am getting the same error and now I got this
"There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: JBBBXJJJ" even I tried to do this task in developer org and three other trailhead playground but it doesn't work.
Please help me out guys.

Thank You
Arpit.
I am a working on Module 'Create a Unique Account List View' and I am recieving the following error when trying to complete the challege.  Does anyone have any suggestions?

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: QMENALZG
User-added image
error at comment line. 

@RestResource(urlMapping='/RestWebservice1/*')
global class RestWebservice1 {
@HttpGet
    global static string doGet(){
       List<Account> accs = [select Name,Phone from Account limit 4];
        System.JSONGenerator jg = JSON.createGenerator(true);
        jg.writeStartObject();
        jg.writeFieldName('Status');
        if(accs.size()>0){
            jg.writeString('Success');
            jg.writeNumberField('count',accs.size());
            jg.writeFieldName('Accounts');
            for(Account a: accs){
                jg.writeStartObject();    // I'm getting error here 
                jg.writeStringField('Name', a.Name);
                jg.writeStringField('Phone', a.Phone);
                jg.writeEndObject();
            }
        }else{
            jg.writeString('Failed');
            jg.writeStringField('Reason', 'No Records Found');    
        }
        jg.writeEndObject();
            string result=jg.getAsString();
            System.debug('Json String :'+result);
        return result;
    } 
}
Hi,

I am creating a vf page on which i need to show account,opportunity and opportunity contact role with a checkbox and a custom button(Clone). I need to clone all the selected records after click on this button.

I am new to Salesforce and have worked on this functionality for a long time. I would really appreciate your help on this functionaly. 
 
Performing the first Challenge of this Superbadge for APEX, I am receiving the below error. But it is not true because the Maintenance Request does indeed have all of the attributes cited when I try via the GUI and via a Test Class. Can someone please tell me what is wrong?

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.

(Also, the challenge didn't specifically mention that the Case and Product2 objects should be relabeled)
Hi,

I am writing a test class for a trigger, in that test class when I am getting this error when I write my login in system.runas method but when I write same login in another function it will work. "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, The formula in the "Room Certification Expiry Date" rule or process is invalid due to the following:<br/>Error evaluating formula field for time trigger date:  Room Certification: Expiry Date: " Please tell what is the issue.

Here is the code of Trigeer and test class-

Trigger:-
trigger RG_RoomCertificationExpiryDateUpdate on Room_Certification__c  (After insert,before update)
{    
List<Room_Certification__c > roomCertificationList=[select id,name,Certification_Date__c,Visit__r.Study__r.Study_Certificate_Duration__c from Room_Certification__c where id In:trigger.newMap.keySet()];
 
   if(Trigger.IsUpdate)
   {
    for(Room_Certification__c roomCert:roomCertificationList)
    {
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c=='Duration of Study')
        {
                trigger.newMap.get(roomCert.id).CertificationExpiryDate_String__c='Duration of Study';
        }
        
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!='Duration of Study' && roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!=null )
        {
                string monthh=roomCert.Visit__r.Study__r.Study_Certificate_Duration__c.removeEnd('m');
                system.debug('@@month'+monthh);
                Date dt=(trigger.newMap.get(roomCert.id).Certification_Date__c.AddMonths(Integer.ValueOf(monthh)))-1;
                system.debug('@@CalculatedDate'+dt);
                trigger.newMap.get(roomCert.id).CertificationExpiryDate_String__c=dt.format();
        }
    }
    }
    //After insert
    if(Trigger.IsInsert)
   {
    List<Room_Certification__c> exCertiChildUpdate=new List<Room_Certification__c>();
    for(Room_Certification__c roomCert:roomCertificationList)
    {
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c=='Duration of Study')
        {
                roomCert.CertificationExpiryDate_String__c='Duration of Study';
                exCertiChildUpdate.add(roomCert);
        }
        
        if(roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!='Duration of Study' && roomCert.Visit__r.Study__r.Study_Certificate_Duration__c!=null )
        {
                string monthh=roomCert.Visit__r.Study__r.Study_Certificate_Duration__c.removeEnd('m');
                system.debug('@@month'+monthh);
                Date dt=(trigger.newMap.get(roomCert.id).Certification_Date__c.AddMonths(Integer.ValueOf(monthh)))-1;
                system.debug('@@CalculatedDate'+dt);
                roomCert.CertificationExpiryDate_String__c=dt.format();
                exCertiChildUpdate.add(roomCert);
        }
    }
    if (exCertiChildUpdate.isEmpty() == false)
    {
        Database.update(exCertiChildUpdate);
    }
    }
}
Test Class:-
@isTest
public class RG_RoomCertificationExpiryDate_Test
{
    public static testmethod void main()
    {
        //Client Create
        Account acc= new Account(Name='Test');
        insert acc;
        //Study Create
        Study__c study= new Study__c(Client__c=acc.id,Name='Testing',NumberofExaminerCertificationRounds__c=2,PONumber__c='123456',Study_Certificate_Duration__c='Duration of Study');
        insert study;
        //Site Create
        Site__c site= new Site__c(Name='Testing Site',Zip_Postal_Code__c='301001',City__c='Delhi');
        insert site;
        //Visit Create
        Visit__c Visit= new Visit__c(Study__c=study.id,Round__c=2,VisitType__c='Visit',VisitStatus__c='Contacted',SiteC__c=site.id,Study_Specific_Site_Number__c='123456');
        insert Visit;
        //Room Create
        Room__c Room= new Room__c(Room_Name__c='Test',SiteC__c=site.Id);
        insert Room;
        //Room Certification Create
        Room_Certification__c Rc= new Room_Certification__c(Room__c=Room.Id,Status__c='certified',Room_Certification_Round__c=2,Certification_Date__c=Date.Today(),VisitSite__c=site.id,Visit__c=Visit.Id);
        Insert Rc;
        study.Study_Certificate_Duration__c='6m';
        update study;
    }
    public static testmethod void main1()
    {
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
        EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',LocaleSidKey='en_US',ProfileId=p.Id,
        TimeZoneSidKey='America/Los_Angeles', UserName='Testingapexclass@gmail.com');
        system.RunAs(u)
        {
            //Client Create
            Account acc= new Account(Name='Test');
            insert acc;
            //Study Create
            Study__c study= new Study__c(Client__c=acc.id,Name='Testing',NumberofExaminerCertificationRounds__c=2,PONumber__c='123456',Study_Certificate_Duration__c='Duration of Study');
            insert study;
            //Site Create
            Site__c site= new Site__c(Name='Testing Site',Zip_Postal_Code__c='301001',City__c='Delhi');
            insert site;
            //Visit Create
            Visit__c Visit= new Visit__c(Study__c=study.id,Round__c=2,VisitType__c='Visit',VisitStatus__c='Contacted',SiteC__c=site.id,Study_Specific_Site_Number__c='123456');
            insert Visit;
            //Room Create
            Room__c Room= new Room__c(Room_Name__c='Test',SiteC__c=site.Id);
            insert Room;
            //Room Certification Create
            Room_Certification__c Rc= new Room_Certification__c(Room__c=Room.Id,Status__c='certified',Room_Certification_Round__c=2,Certification_Date__c=Date.Today(),VisitSite__c=site.id,Visit__c=Visit.Id);
            Insert Rc;
        }
    }
}
Hi All,

Why a custom is not deleted that was in relationship?

Regards,
Arpit
Hi All,
Can we use one object in two applications?

Arpit Jain