• muni u 5
  • NEWBIE
  • 5 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies
Hi All,
I have faced an issue while creating a SKILL coding.Can any help me that how to create a SKILL through coding?

Below is the issue I have faced.
Skill Insert Error Cany some one help me ASAP.

Regards,
Muni.
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
Hi all, My requirement is  1.Create a date time field on contact 2.Display contact records with checkboxes 3.By click on update button selected contact should get updated with time in the record. Here I am placing my code. I am unable to complete this lightning component. please help me .your help is appreciated.Thank you

<***************APEX CLASS*************************>

public class getAllContactRecords 
{
    @AuraEnabled
    public static List<contactListWrapper> getContacts()
    {
        List<contactListWrapper> lstContactWrap=new List<contactListWrapper>();
        for(Contact con:[select id,Name from Contact limit 10])
        {
            lstContactWrap.add(new contactListWrapper(false,con));
        }
        return lstContactWrap;
    }
    
    /* wrapper class */  
    public class contactListWrapper 
    {
        @AuraEnabled public boolean isChecked ;
        @AuraEnabled public  contact objContact ;
        public contactListWrapper(boolean isChecked, contact objContact)
        {
            this.isChecked = isChecked;
            this.objContact = objContact;
        }
    }
    
}


<***************LTNG COMPONENT*************************>

<aura:component controller="getAllContactRecords" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
   <!-- aura attributes to store data/values --> 
    <aura:attribute name="ContactList" type="Contact[]"/>
    <!-- call doInit method on component load -->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <aura:iteration items="{!v.ContactList}" var="obj">
        
        <tr>
            <td>  <ui:inputCheckbox text="{!obj.objContact.Id}"
                                    value="{!obj.isChecked}"
                                    change="{!c.checkboxSelect}" aura:id="chkBoxId"/>
            </td>
            <td>
                {!obj.objContact.Name} <br/> 
            </td>
        </tr>

    </aura:iteration>
    
    <lightning:button label="Update" onclick="{!c.updateSelectedRecords}"/> 
</aura:component>

<***************LTNG CONTROLLER*************************>
({
    doInit : function(component, event, helper) 
    {
        var action=component.get("c.getContacts");
        action.setCallback(this, function(data){
            
            component.set("v.ContactList",data.getReturnValue());
            
        });  
        $A.enqueueAction(action);
    },
    
    
    checkboxSelect : function(component, event, helper) 
    {
         alert('test');
        var selectedHeaderCheck = event.getSource().get("v.text");
        var checkVar=component.find("v.chkBoxId");
        alert(selectedHeaderCheck);
     //  $A.enqueueAction(action);
    },
    
    updateSelectedRecords : function(component, event, helper) 
    {
        alert('test 1')
       var check=component.find("v.chkBoxId");
         if (check.get("v.value") == true)
         {
          //         updateId.push(getAllId.get("v.text"));
         }
      // $A.enqueueAction(action); 
    }
    
    
})
 
Hi All,
I have faced an issue while creating a SKILL coding.Can any help me that how to create a SKILL through coding?

Below is the issue I have faced.
Skill Insert Error Cany some one help me ASAP.

Regards,
Muni.
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