You need to sign in to do that
Don't have an account?
muni u 5
how to write test class for service resource skill object in field service lightning
how to write test class for service resource skill object in field service lightning?Below is my code
//creating a ServiceResource
ServiceResource objServiceResource=new ServiceResource();
objServiceResource.Name='Test Resource';
objServiceResource.RelatedRecordId=u.Id;
objServiceResource.ResourceType='T';
objServiceResource.IsActive=True;
objServiceResource.Status_Code__c='SB';
insert objServiceResource;
//creating a ServiceResourceSkill
objServiceResourceSkill.ServiceResourceId=objServiceResource.Id;
objServiceResourceSkill.SkillId=-------;
objServiceResourceSkill.EffectiveStartDate=System.today();
objServiceResourceSkill.EffectiveEndDate=System.today();
insert objServiceResourceSkill;
this is the test obj i have created.I am unable to understand how to give 'SkillId' for the ServiceResourceSkill
Can any one please help me.
Thankyou,
Muneeswar
//creating a ServiceResource
ServiceResource objServiceResource=new ServiceResource();
objServiceResource.Name='Test Resource';
objServiceResource.RelatedRecordId=u.Id;
objServiceResource.ResourceType='T';
objServiceResource.IsActive=True;
objServiceResource.Status_Code__c='SB';
insert objServiceResource;
//creating a ServiceResourceSkill
objServiceResourceSkill.ServiceResourceId=objServiceResource.Id;
objServiceResourceSkill.SkillId=-------;
objServiceResourceSkill.EffectiveStartDate=System.today();
objServiceResourceSkill.EffectiveEndDate=System.today();
insert objServiceResourceSkill;
this is the test obj i have created.I am unable to understand how to give 'SkillId' for the ServiceResourceSkill
Can any one please help me.
Thankyou,
Muneeswar
For SkillId, you have to give the reference of the ID of the skill.
Create an object of skill and give the Id in SkillId.
Go through with this link, it will help you
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_skilluser.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_skill.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
Thanks for the reference and for providing the links.
Actuallly I have tried to Create a 'Skill' in developerConsole.But it throwed an error like "DML operation Insert not allowed on Skill".
And in the testclass aslo i am unablke to create the skill.Do u have any idea??
Thanks and Regards,
Muni
When I have tried to create a Skill from developer console.i got this error
Skill objSkill=new Skill();
objSkill.DeveloperName='A1';
objSkill.MasterLabel='A1';
insert objSkill;
below is the Error :
I have an external system that is providing us with skills and I want to be able to create a skill in apex of course but I am getting the same error from above...
Thankyou for responding for the issue.Any way I have resolved the above issue long time back ago.
Thankyou all for ur responses.
How did you solve this issue?