• Atul Shendge 2
  • NEWBIE
  • 70 Points
  • Member since 2019

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

Hi Team,
Need to create custom batch apex to populate a new custom numeric field (Count_c) on the account object to denote the number of emails sent to the account.

Requirement:

We have an object Emailtarns_c where email sent are stored. Below is the query.

Select OCE__Account__r.name, count (OCE__Emailplate__r.name) from OCE__EmailTrans__c group by OCE__Account__r.name limit 10

Regards,
Atul

Hi Team,

There is a batch class where a code coverage is 12%. need at 90% to push it to Production

Below is the batch class and Test class.

Batch class:
global class THX_Batch_UpdateType_Channel_Call implements Database.Batchable<sObject>, Schedulable{

    //Query to all calls modified today and yesterday, in status submitted, and not executed in this batch
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator('SELECT Id, Date__c, Status__c, Channel__c, CallType__c, THX_Updated_Type_Channel__c' +
                                        ' FROM Call__c' +
                                        ' WHERE lastModifieddate = LAST_N_DAYS:1 and (NOT CreatedBy.Profile.Name LIKE \'%Admin%\') AND Status__c LIKE \'Submitted\' AND THX_Updated_Type_Channel__c = false AND ParentCall__c = null');
    }

    global void execute(Database.BatchableContext BC, List<Call__c> scope){
        list<Call__c> listAttendees = [SELECT id, ParentCall__c FROM Call__c WHERE ParentCall__c in :scope];
        list<CallPresentation__c> listCallPresent = [SELECT id, Call__c FROM CallPresentation__c WHERE Call__c in :scope];
        
        if(listCallPresent.size() > 0 || listAttendees.size() > 0){
            set<id> setIdCallUpdateByPresentation = new set<id>();
            for(CallPresentation__c callPres: listCallPresent){
                setIdCallUpdateByPresentation.add(callPres.Call__c);
            }
            
            set<id> setIdCallUpdateByAttendees = new set<id>();
            set<Id> setCallWithAttendees = new set<Id>();
            map<id, list<Call__c>> mapAttendeeToUpdate = new map<id, list<Call__c>>();
            
            for(Call__c attendee: listAttendees){
                setIdCallUpdateByAttendees.add(attendee.ParentCall__c);
                if(mapAttendeeToUpdate.get(attendee.ParentCall__c) == null){
                    list<Call__c> listAttend = new list<Call__c>{attendee};
                    mapAttendeeToUpdate.put(attendee.ParentCall__c, listAttend);
                }else{
                    list<Call__c> listAttend = mapAttendeeToUpdate.get(attendee.ParentCall__c);
                    listAttend.add(attendee);
                    mapAttendeeToUpdate.put(attendee.ParentCall__c, listAttend);
                }
            }
            
            list<Call__c> listCallUpdate = new list<Call__c>();
            if(setIdCallUpdateByPresentation.size() > 0 || setIdCallUpdateByAttendees.size() > 0){
                for(Call__c call: scope){
                    boolean updateCall = false;
                    if(setIdCallUpdateByPresentation.contains(call.id)){
                        call.Channel__c = 'EC';
                        updateCall = true;
                        if(mapAttendeeToUpdate.get(call.id) != null){
                            for(Call__c attend: mapAttendeeToUpdate.get(call.id)){
                                attend.Channel__c = 'EC';
                            }
                        }
                    }
                    if(setIdCallUpdateByAttendees.contains(call.id) && mapAttendeeToUpdate.get(call.id).size() > 1){
                        call.CallType__c = 'Group Call';
                        updateCall = true;
                        if(mapAttendeeToUpdate.get(call.id) != null){
                            for(Call__c attend: mapAttendeeToUpdate.get(call.id)){
                                attend.CallType__c = 'Group Call';
                            }
                        }
                    }
                    if(updateCall){
                        call.THX_Updated_Type_Channel__c = true;
                        listCallUpdate.add(call);
                        if(mapAttendeeToUpdate.get(call.id) != null){
                            for(Call__c attend: mapAttendeeToUpdate.get(call.id)){
                                attend.THX_Updated_Type_Channel__c = true;
                                listCallUpdate.add(attend);
                            }
                        }
                    }
                }
                update listCallUpdate;                
            }
            
        }
        
    }

   global void finish(Database.BatchableContext BC){
   }
    
  global void execute(SchedulableContext SC) {
        THX_Batch_UpdateType_Channel_Call batch = new THX_Batch_UpdateType_Channel_Call();
        Id batchId = Database.executeBatch(batch, 200);
    }
    
    
}

Test class:
@isTest(SeeAllData=false)
public class THX_Batch_UpdateType_Channel_Call_Test {
    
    static void setup() {
        Profile p = [SELECT Id FROM Profile WHERE Name='THX Rep'];
        String nameUser = 'standarduser' + DateTime.now().getTime() + '@testorg.com';
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
                            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
                            LocaleSidKey='en_US', ProfileId = p.Id,Phone='123',
                            TimeZoneSidKey='America/Los_Angeles',MobilePhone='123',
                              UserName=nameUser, firstname='Firstname', Street='123');
        
        System.runAs(u) {
            Account ac = THX_TestDataFactory.createAccount('MP');
            insert ac;
            
            Product__c prod = THX_TestDataFactory.createProduct('NameProd');
            insert prod;
        
            Presentation__c presentation = THX_TestDataFactory.createPresent('NamePresentation');
            insert presentation;
            
            Call__c call = THX_TestDataFactory.createCall(ac.id, system.now());
            call.Status__c = 'Submitted';
            insert call;
            
            CallDetail__c callDet = THX_TestDataFactory.createCallDetail(call.id, prod.id);
            insert callDet;
            
            Call__c callAttendee1 = THX_TestDataFactory.createCall(ac.id, call.CallDateTime__c);
            callAttendee1.ParentCall__c = call.id;
            Call__c callAttendee2 = THX_TestDataFactory.createCall(ac.id, call.CallDateTime__c);
            callAttendee2.ParentCall__c = call.id;
            list<Call__c> listAtt = new list<Call__c>{callAttendee1, callAttendee2};
            insert listAtt;
            
            CallPresentation__c callPres = THX_TestDataFactory.createCallPresent(call.id, presentation.id);
            insert callPres;
          }
        
    }
    
    static testmethod void test() {        
            THX_Batch_UpdateType_Channel_Call batchUpdateCalls = new THX_Batch_UpdateType_Channel_Call();
            Id batchId = Database.executeBatch(batchUpdateCalls);
    }
    
    static testMethod void updateCallsScheduled(){
        System.Test.startTest();
            THX_Batch_UpdateType_Channel_Call batch = new THX_Batch_UpdateType_Channel_Call();
            Datetime dt = Datetime.now();
            dt = dt.addMinutes(1);
            String timeForScheduler = dt.format('s m H d M \'?\' yyyy'); 
            Id schedId = System.Schedule('Test Batch update calls', timeForScheduler, batch);
        System.Test.stopTest();
    }
    
}
Hi All,
I have a situtation below.

Where I need to create a new formula field on Account Object which recalculate the value every time that the User invites to the same account to an "lunch" per year, this number will increase, but each new year, this number will refresh to '0'.

Example: if User 1 invite Account 'A' 1 time and User 2 invite the same Account 'A' 1 time, we would like to inform the User on system.
Hi All,

Hope you all are doing good!

I have a requirement where a batch job needs to applied.
  • I have created a field Stage type text on Account object
  • Create a job that updates stage field  according to the User's language ( select id, PersonTitle, Language_c, UniqueID_c from Account where UniqueID_c != null and RecordType_c = 'Business' )
  • The problem is for Belgium accounts that have 2 languages ​​French and Dutch, and always translate to French
Regards,
Atul
Hi All,

Hope you all are doing good, Need your help on below issue.

There is field xxxx which will be visible for all countries, It will be enable for all the country user including FR.
I need write a validation rule, when the call is saved or submitted, it checks the user's country and if it is different from FR, it shows an error

Regards,
Atul
Hi All,

Hope you all are safe!

I have a requirement, when a user tries create a Account and when user enter a First Name and Last Name, In this case, If user enters all letter of FirstName and LastName as capital or small, Upon saving user should see first letter of FirstName as capital same goes with LastName as well.

For e.g.
If user enter like JOHN ADAM, It should display John Adam.

Thanks in Advance,
 
Hi All,

I have a requirement where, when an employee login and logout in SF the time should be tracked and end of month report should be generated accordingly.

In Addition, if employee is working 9-5 and he logs in at 10 in report it should color in red.

Help would be really appreciated

Thanks and Regards,
Atul Shendge
Hi,
I was doing the trailhead challenge on "Create SOQL Queries in Apex Classes"

Create a class
Name: AccountUtility
Create a method
Name: viewAnnualRevenue
Keywords: public, static, and void
Create a list
Name: accountsList
Create a query and assign the results to a list
Fields: Name and annual revenue (Hint: Use API names, not field names or labels)
Object: Account
Create a for loop that iterates through the query results
Object: Account
List name: accountsList
For each item, concatenate the account name, followed by a colon, followed by the account’s annual revenue: <account name> : <annual revenue>
Store the concatenated string in a variable named acctRev
Print the acctRev variable to the debug log:

I have written a code below:
public class AccountUtility {
    public static void viewAnnualRevenue (){
      List<Account> accountsList = [SELECT Name, AnnualRevenue FROM Account];
        for(Account acc: accountsList){
            //Looping the class through the query
            String name = '<Account Name>: ' + acc.Name +', <Annual Revenue> : ' + acc.AnnualRevenue;
            system.debug(name);
        }
    }

}

I am getting an error while passing the challenge "We can’t find the correct results format. Make sure that your concatenation puts each list item in this format: 'Account Name' : 'Account Revenue'."

Help would be appreciated.

Regards,
Atul Shendge
Hi,

when there are 100 user with same profile in salesforce which has CRUD permission, now out of whicg 5 user should not have delete permission, how to achieve.

Thanks and Regards,
Atul Shendge
Hi All,
Write a trigger to delete the contacts associated with account object where account is inactive.

Regards,
Atul
Hi,

When I am writing below code, I am getting an error 'Variable does not exist: theRecord'
Here is the code:
public class CustomMetadataService {
    public CustomMetadataService() {}
    /**
     * This method instantiates a custom metadata record of type Support_Tier__mdt
     * and sets the DeveloperName to the input String.
     * The record is not inserted into the database, 
     * and would not be found by a SOQL query.
     */
    public Support_Tier__mdt getCustomMetadataRecord(String myName) {
        Support_Tier__mdt supportTier = new Support_Tier__mdt();
        theRecord.DeveloperName = myName;
        return supportTier;
    }
    /**
     * This method retrieves a custom metadata record, changes a field, and returns it
     * to the caller, but does not update the database.
     */
    public Support_Tier__mdt getChangedCustomMetadataRecord(String myNewName) {
        Support_Tier__mdt supportTier = [SELECT Id, DeveloperName from Support_Tier__mdt LIMIT 1];
        theRecord.DeveloperName = myNewName;
        return supportTier;
    }
}
 Help would be really appreciated.

Regards,
Atul Shendge
Hi,
In my scenario, I have a field called question and it should be mandatory, If User missed to enter this field it should throw an error and I am trying this to acheive through Lightning component. 
Below is the component code which is working fine:
<lightning:layout>
        <lightning:layoutitem><p style="color:red;">*</p></lightning:layoutitem>&nbsp;
        <lightning:layoutitem>
            <tr><td>
                <div style="font-size:14px;color:black;"><B>Question 1 </B> </div>
                </td></tr>
            <p>
                <br/>
        What is the invention? What problem does the invention solve? What are the features of the invention and how do they solve the problem? Describe your implementation(s) of the invention using examples. (Note: you can upload drawings and other documents in Step 5.)
    </p>
            <tr><td> <lightning:inputRichText aura:id="TxtAnswer1" onblur="{!c.assignAnswer1}" value="{!v.QuestAnswer1}"/></td></tr>
        </lightning:layoutitem>
    </lightning:layout>
    <br/>

Here is the Controller and I think something needs to be added in this but I am not sure, Below is the Controller code:
{
    assignAnswer1 : function(component, event, helper) {
        var Answer1=component.find("TxtAnswer1").get("v.value");
        component.set("v.QuestAnswer1", Answer1);

Any help would be really appreciated.

Regards,
Atul Shendge
Hi All,

When Record is submitted as Draft. Profile should have edit access for that Draft.
Two profile: P1 and P2. Two page layout created for both profile one is read only and other Read/Write access. When P1 submit a record as status is saved as Draft . P1 should have access to Edit that record.

Page layout in detail page if I had Edit button. It assign to both the page layout. Is there any other way around to achieve this.

Thanks for the help in advance
Hi All,

I have a profile called Platform Inventor, who should not edit Docket No (API is Name) which is Standard field. In page layout and FLS it is restricted. I have wrote Validation rule:

AND(
ISCHANGED(Name),
$Profile.Name = "Platform Inventor",
RecordType.Name="Invention_Information")

With this rule I am still able to edit and Save the field.

Help will be appreciated.

Thanks,
Atul Shendge
We need to restrict the no of child=2 on a master object. How will do this only using configuration?
Hi,
I have tried inserting records and when I try to save it, A record should get created in Custom object. But when I try with below code it is not.

Any help would be appreciated.
Class:
public class appleIDFctrl {
    @auraEnabled
    public static myWrapper doInitial()
    {
        myWrapper wrp = NEW myWrapper();
        wrp.inv = NEW SymphonyIPM__Inventor__c();
        wrp.countriesOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__Location__c');
        wrp.citizenshipOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__CitizenshipPicklist__c');
        wrp.clientOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__EmploymentCategory__c');
        //system.debug(wrp);
        return wrp;
    }
    @auraEnabled
    public static void saveData(myWrapper myData)
    {
        system.debug(myData.inv);
        insert myData.inv;
        
    }
    public class myWrapper{
        @auraEnabled Public SymphonyIPM__Inventor__c inv{set;get;}
        @auraEnabled Public List<optionsWrapper> countriesOptions{set;get;}
        @auraEnabled Public List<optionsWrapper> citizenshipOptions{set;get;}
        @auraEnabled Public List<optionsWrapper> clientOptions{set;get;}
    }
    public class optionsWrapper{
        @auraEnabled public string value{set;get;}
        @auraEnabled public string label{set;get;}
    }
    public static list<optionsWrapper> getPicklistValues(string objectName, string fieldName)
    {
        List<optionsWrapper> options = NEW List<optionsWrapper>();
        
        Schema.SObjectType s = Schema.getGlobalDescribe().get(objectName) ;
        Schema.DescribeSObjectResult r = s.getDescribe() ;
        Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
        Schema.DescribeFieldResult fieldResult = fields.get(fieldName).getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple)
        {
            optionsWrapper newOpt = NEW optionsWrapper();
            newOpt.label = pickListVal.getLabel();
            newOpt.value = pickListVal.getValue();
            options.add(newOpt);
        }
        if(options.size()>0)
        {
            return options;            
        }
        else{
            optionsWrapper newOpt = NEW optionsWrapper();
            newOpt.label = '--No Data--';
            newOpt.value = '';
            options.add(newOpt);
            return options;
        }
    }    
}
Component:
<aura:component controller="appleIDFctrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:availableForFlowScreens" access="global" >
    
    <aura:attribute name="Inventor" type="Boolean" default="false" />
    <aura:attribute name="Add" type="String" default=" " />
    <aura:attribute name="myData" type="Object"/>
    <aura:attribute name="Add1" type="Boolean" default="false"/>
    <aura:handler name="init" value="{!this}" action ="{!c.doInIt}"/>
    <h3><b>Inventors:*</b></h3>
    <br/>
    <p>Please click on the Primary Inventor Contact below to search and select a name.</p>
    <br/>
    <div> <b>IC1 </b><lightning:button class="customButton" variant="brand-outline" aura:id="prim" label="Primary Inventor Contact" onclick="{! c.handleClick }" value="{!v.Inventor}"/>
    </div>
    <!--<aura:if isTrue="{!v.Inventor}" />-->
    <br/>
    
    <div> <b>Other Potential Inventors </b><lightning:button class="customButton" variant="brand-outline" aura:id="ad" label="Add" onclick="{! c.OnAdd }" value="{!v.Add}"/>
        &nbsp;&nbsp;
        <lightning:button class="customButton" variant="brand-outline" aura:id="ade" label="Add Non-Employees" onclick="{! c.OnAdd1 }" value="{!v.Add1}"/>
    </div>
    
    <aura:if isTrue="{!v.Add1}">
        
<lightning:select name="Country" label="Country" value="{!v.myData.inv.SymphonyIPM__Location__c}">
                <aura:iteration var="opt" items="{!v.myData.countriesOptions}">
                    <option value="{!opt.value}" text="{!opt.label}"/>
                </aura:iteration>
            </lightning:select>            
                </div>
                </div>
            <br/>
            <p>Other Information</p>
            <hr/>
              <div class= "slds-grid slds-gutters">
             <div class="slds-col">
            <lightning:select name="Citizenship" label="Citizenship" value="{!v.myData.inv.SymphonyIPM__CitizenshipPicklist__c}">
                <aura:iteration var="opt" items="{!v.myData.citizenshipsOptions}">
                    <option value="{!opt.value}" text="{!opt.label}"/>
                </aura:iteration>
            </lightning:select>
</div>
                    </div>
            <br/>
            <lightning:button label="Save" onclick="{!c.save}"/>
        
        </div>
        </aura:if>
    
</aura:component>

Controller:
save : function(cmp, event, helper) {
        var allData = cmp.get("v.myData");
        alert("From server: " + JSON.stringify(allData.inv));
        var action = cmp.get("c.saveData");
        action.setParams({ myData : allData });
        action.setCallback(this, function(response) {
            alert(response.getState());
            var state = response.getState();
            if (state === "SUCCESS") {
                alert(state);
            }
            else if (state === "INCOMPLETE") {
                alert(state);
            }
                else if (state === "ERROR") {
                    alert(state);
                    var errors = response.getError();
                    if (errors) {
                        if (errors[0] && errors[0].message) {
                            console.log("Error message: " + 
                                        errors[0].message);
                        }
                    } else {
                        console.log("Unknown error");
                    }
                }
        });
    },
    
})

Helper:
({
    helperdoInIt : function(cmp, event, helper) {
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        var action = cmp.get("c.doInitial");
        //action.setParams({ firstName : cmp.get("v.firstName") });

        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                //alert("From server: " + JSON.stringify(response.getReturnValue()));
                cmp.set("v.myData",response.getReturnValue());
                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        // optionally set storable, abortable, background flag here

        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);
    }
})

Thanks
Atul Shendge
Hi,

Requirement on my use case is "Need a radiobutton horizontal" I have written component and when I preview it display in a horizontal way, but when I call that component in Flow "It displays in vertical way"

Below is my Component code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:availableForFlowScreens" access="global" >
        <aura:attribute name="Products" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       {'label': 'Not Sure', 'value': 'Not Sure'}
                                                       ]"/>  
    <aura:attribute name="NDA" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Joint" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Standards" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Open" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Govt" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    
    <aura:attribute name="ProductsValue" type="String" />
    <aura:attribute name="NDAValue" type="String" />
    <aura:attribute name="Technical" type="String" default=" " />
    <aura:attribute name="Art" type="String" default=" " />
       
    <p><b>Product Announcement, Disclosure To Vendor, Use or Sale, Beta Testing and other time sensitivity:*</b></p>   
    <br/>
    <p> Is any aspect of this invention going to be disclosed to anyone outside of Apple within the next 3 months (e.g. in a product announcement or in a product release)? External disclosure may affect Apple's patent rights even if it occurs under the purview of an NDA (e.g., in a developer seed, to a vendor). Is the primary contact for this invention going to be unavailable in the near term to assist with a patent application (e.g., leaving Apple or for an extended business trip)? *</p>
    <br/>
    <lightning:radioGroup name="myColors" 
                          label=" "
                          options="{! v.Products }"
                          value="{! v.ColorValue }"
                          type="radio"
                          />
    <br/>
    
    <p>Has a description of your invention been published outside of Apple, or is external publication, or product announcement, including disclosure under NDA, planned? This includes communication to suppliers under NDA. If so, please describe the disclosure event and provide a date. If no date is known with certainty, please provide an estimate. If none, please state NONE.</p>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>NDA (non disclosure agreement): </b></p>
    <br/>
    <p>Might there be any NDA related to this disclosure? </p>
    <br/>
    <lightning:radioGroup name="myNDA" 
                          label=" "
                          options="{! v.NDA }"
                          value="{! v.NDAValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Conception and Implementation </b></p>
    <hr/>
    <br/>
    <p><b>Conception:</b></p>
    <br/>
    <p>Provide an estimated date when the invention was first conceived. If you have any written evidence of the date of conception, please upload it under Disclosure Documents. Also provide a description of any written evidence of the date of conception. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>Conception Location:</b></p>
    <br/>
    <p>If the invention was NOT completely conceived in the US, please provide the country in which the invention was conceived. If the conception of the invention occurred in more than one country, please provide all countries and an estimated percentage for each country. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>Implementation:</b></p>
    <br/>
    <p>Has the invention been built or implemented? If so, please provide the details of the first time the invention was built or implemented (when, where, by whom, etc). If none, please state NONE. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    
    <br/>
    <p><b>Joint Development / Standards / Open Source Code / Government Project </b></p>
    <hr/>
    <br/>
    <p><b>Joint Development:</b></p>
    <br/>
    <p>Was your invention conceived, or made in collaboration with, anyone other than an Apple employee or Apple-hired contractor? Please list any joint development projects related to this invention. </p>
    <br/>
    <lightning:radioGroup name="myJoint" 
                          label=" "
                          options="{! v.Joint }"
                          value="{! v.JointValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Standards:</b></p>
    <br/>
    <p>Might this invention relate to an existing or future-developed technical standard? </p>
    <br/>
    <lightning:radioGroup name="myStandards" 
                          label=" "
                          options="{! v.Standards }"
                          value="{! v.StandardsValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Open Source Code:</b></p>
    <br/>
    <p>Might there be any related open source issues? </p>
    <br/>
    <lightning:radioGroup name="myOpen" 
                          label=" "
                          options="{! v.Open }"
                          value="{! v.OpenValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Government Project:</b></p>
    <br/>
    <p>Was the invention developed under a Government Agreement or in conjunction with a Governmental laboratory, department, or agency? Please list any government development projects related to this invention. </p>
    <br/>
    <lightning:radioGroup name="myGovt" 
                          label=" "
                          options="{! v.Govt }"
                          value="{! v.GovtValue }"
                          type="radio"
                          />
    <br/>
    <p><b>Technical Review</b></p>
    <hr/>
    <br/>
    <p><b>Technical Reviewer(s):</b></p>
    <div> <b>In addition to patent committee, is there anyone who you would like to provide comments or feedback on your invention? </b><lightning:button class="customButton" variant="brand" aura:id="tech" label="Add" onclick="{! c.handleClick }" value="{!v.Technical}"/></div>
    <br/><br/>
    <p><b>Known Art</b></p>
    <hr/>
    <br/>
    <p><b>Known Art Attachments: </b></p>
    <br/>
    <p>Identify the closest or most relevant known art that you are currently aware of, including your own previously-filed patent applications. Please attach any known art documents below that you have. There is no need to do a search. </p>
    <br/>
    <div><b>Known Art (Publications and Patents) </b><lightning:button class="customButton1" variant="brand" aura:id="Art" label="Add" onclick="{! c.handleClick }" value="{!v.Art}"/></div>
    <br/><br/>
    <p><b>Inventor Comments</b></p>
    <hr/>
    <br/>
    <p><b>Inventor Comments:</b></p>
    <br/>
    <p>Please provide any additional comments you may have in the space provided. If you have no additional comments, please explicitly state NONE. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/><br/>
    <p>Once you have completed the entire IDF,  [  Print  ] out a final copy, and keep it for your record.</p>
    <hr/>
</aura:component>
Please need help on thisUser-added image
We have a certain case record type whose cases require a special auto-numbering system. This auto-number must be in the format of {YY}{0000}. The number in {0000} needs to reset to 1 every January 1. So, if the very first case this year is 200001, and the 
Hi,
There is a requirement:
Docket number will be auto-generated on record creation.
It will create a docket number in YYXXXX format where YY - current year (automatically changes every year) and XXXX - is the incremental value which gets set to one on January 1st of 
of every year
Example – 200001 - first disclosure created in 2020
How can I run a report on all the custom fields in an custom object?
We have a certain case record type whose cases require a special auto-numbering system. This auto-number must be in the format of {YY}{0000}. The number in {0000} needs to reset to 1 every January 1. So, if the very first case this year is 200001, and the 
Hi All,

Hope you all are doing good, Need your help on below issue.

There is field xxxx which will be visible for all countries, It will be enable for all the country user including FR.
I need write a validation rule, when the call is saved or submitted, it checks the user's country and if it is different from FR, it shows an error

Regards,
Atul
Hi,
I was doing the trailhead challenge on "Create SOQL Queries in Apex Classes"

Create a class
Name: AccountUtility
Create a method
Name: viewAnnualRevenue
Keywords: public, static, and void
Create a list
Name: accountsList
Create a query and assign the results to a list
Fields: Name and annual revenue (Hint: Use API names, not field names or labels)
Object: Account
Create a for loop that iterates through the query results
Object: Account
List name: accountsList
For each item, concatenate the account name, followed by a colon, followed by the account’s annual revenue: <account name> : <annual revenue>
Store the concatenated string in a variable named acctRev
Print the acctRev variable to the debug log:

I have written a code below:
public class AccountUtility {
    public static void viewAnnualRevenue (){
      List<Account> accountsList = [SELECT Name, AnnualRevenue FROM Account];
        for(Account acc: accountsList){
            //Looping the class through the query
            String name = '<Account Name>: ' + acc.Name +', <Annual Revenue> : ' + acc.AnnualRevenue;
            system.debug(name);
        }
    }

}

I am getting an error while passing the challenge "We can’t find the correct results format. Make sure that your concatenation puts each list item in this format: 'Account Name' : 'Account Revenue'."

Help would be appreciated.

Regards,
Atul Shendge
Hi,

When I am writing below code, I am getting an error 'Variable does not exist: theRecord'
Here is the code:
public class CustomMetadataService {
    public CustomMetadataService() {}
    /**
     * This method instantiates a custom metadata record of type Support_Tier__mdt
     * and sets the DeveloperName to the input String.
     * The record is not inserted into the database, 
     * and would not be found by a SOQL query.
     */
    public Support_Tier__mdt getCustomMetadataRecord(String myName) {
        Support_Tier__mdt supportTier = new Support_Tier__mdt();
        theRecord.DeveloperName = myName;
        return supportTier;
    }
    /**
     * This method retrieves a custom metadata record, changes a field, and returns it
     * to the caller, but does not update the database.
     */
    public Support_Tier__mdt getChangedCustomMetadataRecord(String myNewName) {
        Support_Tier__mdt supportTier = [SELECT Id, DeveloperName from Support_Tier__mdt LIMIT 1];
        theRecord.DeveloperName = myNewName;
        return supportTier;
    }
}
 Help would be really appreciated.

Regards,
Atul Shendge
Hi,
In my scenario, I have a field called question and it should be mandatory, If User missed to enter this field it should throw an error and I am trying this to acheive through Lightning component. 
Below is the component code which is working fine:
<lightning:layout>
        <lightning:layoutitem><p style="color:red;">*</p></lightning:layoutitem>&nbsp;
        <lightning:layoutitem>
            <tr><td>
                <div style="font-size:14px;color:black;"><B>Question 1 </B> </div>
                </td></tr>
            <p>
                <br/>
        What is the invention? What problem does the invention solve? What are the features of the invention and how do they solve the problem? Describe your implementation(s) of the invention using examples. (Note: you can upload drawings and other documents in Step 5.)
    </p>
            <tr><td> <lightning:inputRichText aura:id="TxtAnswer1" onblur="{!c.assignAnswer1}" value="{!v.QuestAnswer1}"/></td></tr>
        </lightning:layoutitem>
    </lightning:layout>
    <br/>

Here is the Controller and I think something needs to be added in this but I am not sure, Below is the Controller code:
{
    assignAnswer1 : function(component, event, helper) {
        var Answer1=component.find("TxtAnswer1").get("v.value");
        component.set("v.QuestAnswer1", Answer1);

Any help would be really appreciated.

Regards,
Atul Shendge
Hi All,

I have a profile called Platform Inventor, who should not edit Docket No (API is Name) which is Standard field. In page layout and FLS it is restricted. I have wrote Validation rule:

AND(
ISCHANGED(Name),
$Profile.Name = "Platform Inventor",
RecordType.Name="Invention_Information")

With this rule I am still able to edit and Save the field.

Help will be appreciated.

Thanks,
Atul Shendge
Hi,
I have tried inserting records and when I try to save it, A record should get created in Custom object. But when I try with below code it is not.

Any help would be appreciated.
Class:
public class appleIDFctrl {
    @auraEnabled
    public static myWrapper doInitial()
    {
        myWrapper wrp = NEW myWrapper();
        wrp.inv = NEW SymphonyIPM__Inventor__c();
        wrp.countriesOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__Location__c');
        wrp.citizenshipOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__CitizenshipPicklist__c');
        wrp.clientOptions = getPicklistValues('SymphonyIPM__Inventor__c','SymphonyIPM__EmploymentCategory__c');
        //system.debug(wrp);
        return wrp;
    }
    @auraEnabled
    public static void saveData(myWrapper myData)
    {
        system.debug(myData.inv);
        insert myData.inv;
        
    }
    public class myWrapper{
        @auraEnabled Public SymphonyIPM__Inventor__c inv{set;get;}
        @auraEnabled Public List<optionsWrapper> countriesOptions{set;get;}
        @auraEnabled Public List<optionsWrapper> citizenshipOptions{set;get;}
        @auraEnabled Public List<optionsWrapper> clientOptions{set;get;}
    }
    public class optionsWrapper{
        @auraEnabled public string value{set;get;}
        @auraEnabled public string label{set;get;}
    }
    public static list<optionsWrapper> getPicklistValues(string objectName, string fieldName)
    {
        List<optionsWrapper> options = NEW List<optionsWrapper>();
        
        Schema.SObjectType s = Schema.getGlobalDescribe().get(objectName) ;
        Schema.DescribeSObjectResult r = s.getDescribe() ;
        Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
        Schema.DescribeFieldResult fieldResult = fields.get(fieldName).getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry pickListVal : ple)
        {
            optionsWrapper newOpt = NEW optionsWrapper();
            newOpt.label = pickListVal.getLabel();
            newOpt.value = pickListVal.getValue();
            options.add(newOpt);
        }
        if(options.size()>0)
        {
            return options;            
        }
        else{
            optionsWrapper newOpt = NEW optionsWrapper();
            newOpt.label = '--No Data--';
            newOpt.value = '';
            options.add(newOpt);
            return options;
        }
    }    
}
Component:
<aura:component controller="appleIDFctrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:availableForFlowScreens" access="global" >
    
    <aura:attribute name="Inventor" type="Boolean" default="false" />
    <aura:attribute name="Add" type="String" default=" " />
    <aura:attribute name="myData" type="Object"/>
    <aura:attribute name="Add1" type="Boolean" default="false"/>
    <aura:handler name="init" value="{!this}" action ="{!c.doInIt}"/>
    <h3><b>Inventors:*</b></h3>
    <br/>
    <p>Please click on the Primary Inventor Contact below to search and select a name.</p>
    <br/>
    <div> <b>IC1 </b><lightning:button class="customButton" variant="brand-outline" aura:id="prim" label="Primary Inventor Contact" onclick="{! c.handleClick }" value="{!v.Inventor}"/>
    </div>
    <!--<aura:if isTrue="{!v.Inventor}" />-->
    <br/>
    
    <div> <b>Other Potential Inventors </b><lightning:button class="customButton" variant="brand-outline" aura:id="ad" label="Add" onclick="{! c.OnAdd }" value="{!v.Add}"/>
        &nbsp;&nbsp;
        <lightning:button class="customButton" variant="brand-outline" aura:id="ade" label="Add Non-Employees" onclick="{! c.OnAdd1 }" value="{!v.Add1}"/>
    </div>
    
    <aura:if isTrue="{!v.Add1}">
        
<lightning:select name="Country" label="Country" value="{!v.myData.inv.SymphonyIPM__Location__c}">
                <aura:iteration var="opt" items="{!v.myData.countriesOptions}">
                    <option value="{!opt.value}" text="{!opt.label}"/>
                </aura:iteration>
            </lightning:select>            
                </div>
                </div>
            <br/>
            <p>Other Information</p>
            <hr/>
              <div class= "slds-grid slds-gutters">
             <div class="slds-col">
            <lightning:select name="Citizenship" label="Citizenship" value="{!v.myData.inv.SymphonyIPM__CitizenshipPicklist__c}">
                <aura:iteration var="opt" items="{!v.myData.citizenshipsOptions}">
                    <option value="{!opt.value}" text="{!opt.label}"/>
                </aura:iteration>
            </lightning:select>
</div>
                    </div>
            <br/>
            <lightning:button label="Save" onclick="{!c.save}"/>
        
        </div>
        </aura:if>
    
</aura:component>

Controller:
save : function(cmp, event, helper) {
        var allData = cmp.get("v.myData");
        alert("From server: " + JSON.stringify(allData.inv));
        var action = cmp.get("c.saveData");
        action.setParams({ myData : allData });
        action.setCallback(this, function(response) {
            alert(response.getState());
            var state = response.getState();
            if (state === "SUCCESS") {
                alert(state);
            }
            else if (state === "INCOMPLETE") {
                alert(state);
            }
                else if (state === "ERROR") {
                    alert(state);
                    var errors = response.getError();
                    if (errors) {
                        if (errors[0] && errors[0].message) {
                            console.log("Error message: " + 
                                        errors[0].message);
                        }
                    } else {
                        console.log("Unknown error");
                    }
                }
        });
    },
    
})

Helper:
({
    helperdoInIt : function(cmp, event, helper) {
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        var action = cmp.get("c.doInitial");
        //action.setParams({ firstName : cmp.get("v.firstName") });

        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                //alert("From server: " + JSON.stringify(response.getReturnValue()));
                cmp.set("v.myData",response.getReturnValue());
                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            else if (state === "INCOMPLETE") {
                // do something
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        // optionally set storable, abortable, background flag here

        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);
    }
})

Thanks
Atul Shendge
Hi,

Requirement on my use case is "Need a radiobutton horizontal" I have written component and when I preview it display in a horizontal way, but when I call that component in Flow "It displays in vertical way"

Below is my Component code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:availableForFlowScreens" access="global" >
        <aura:attribute name="Products" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       {'label': 'Not Sure', 'value': 'Not Sure'}
                                                       ]"/>  
    <aura:attribute name="NDA" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Joint" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Standards" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Open" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    <aura:attribute name="Govt" type="List" default="[
                                                       {'label': 'No', 'value': 'No'},
                                                       {'label': 'Yes', 'value': 'Yes'},
                                                       ]"/>
    
    <aura:attribute name="ProductsValue" type="String" />
    <aura:attribute name="NDAValue" type="String" />
    <aura:attribute name="Technical" type="String" default=" " />
    <aura:attribute name="Art" type="String" default=" " />
       
    <p><b>Product Announcement, Disclosure To Vendor, Use or Sale, Beta Testing and other time sensitivity:*</b></p>   
    <br/>
    <p> Is any aspect of this invention going to be disclosed to anyone outside of Apple within the next 3 months (e.g. in a product announcement or in a product release)? External disclosure may affect Apple's patent rights even if it occurs under the purview of an NDA (e.g., in a developer seed, to a vendor). Is the primary contact for this invention going to be unavailable in the near term to assist with a patent application (e.g., leaving Apple or for an extended business trip)? *</p>
    <br/>
    <lightning:radioGroup name="myColors" 
                          label=" "
                          options="{! v.Products }"
                          value="{! v.ColorValue }"
                          type="radio"
                          />
    <br/>
    
    <p>Has a description of your invention been published outside of Apple, or is external publication, or product announcement, including disclosure under NDA, planned? This includes communication to suppliers under NDA. If so, please describe the disclosure event and provide a date. If no date is known with certainty, please provide an estimate. If none, please state NONE.</p>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>NDA (non disclosure agreement): </b></p>
    <br/>
    <p>Might there be any NDA related to this disclosure? </p>
    <br/>
    <lightning:radioGroup name="myNDA" 
                          label=" "
                          options="{! v.NDA }"
                          value="{! v.NDAValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Conception and Implementation </b></p>
    <hr/>
    <br/>
    <p><b>Conception:</b></p>
    <br/>
    <p>Provide an estimated date when the invention was first conceived. If you have any written evidence of the date of conception, please upload it under Disclosure Documents. Also provide a description of any written evidence of the date of conception. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>Conception Location:</b></p>
    <br/>
    <p>If the invention was NOT completely conceived in the US, please provide the country in which the invention was conceived. If the conception of the invention occurred in more than one country, please provide all countries and an estimated percentage for each country. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/>
    <p><b>Implementation:</b></p>
    <br/>
    <p>Has the invention been built or implemented? If so, please provide the details of the first time the invention was built or implemented (when, where, by whom, etc). If none, please state NONE. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    
    <br/>
    <p><b>Joint Development / Standards / Open Source Code / Government Project </b></p>
    <hr/>
    <br/>
    <p><b>Joint Development:</b></p>
    <br/>
    <p>Was your invention conceived, or made in collaboration with, anyone other than an Apple employee or Apple-hired contractor? Please list any joint development projects related to this invention. </p>
    <br/>
    <lightning:radioGroup name="myJoint" 
                          label=" "
                          options="{! v.Joint }"
                          value="{! v.JointValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Standards:</b></p>
    <br/>
    <p>Might this invention relate to an existing or future-developed technical standard? </p>
    <br/>
    <lightning:radioGroup name="myStandards" 
                          label=" "
                          options="{! v.Standards }"
                          value="{! v.StandardsValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Open Source Code:</b></p>
    <br/>
    <p>Might there be any related open source issues? </p>
    <br/>
    <lightning:radioGroup name="myOpen" 
                          label=" "
                          options="{! v.Open }"
                          value="{! v.OpenValue }"
                          type="radio"
                          />
    <br/><br/>
    <p><b>Government Project:</b></p>
    <br/>
    <p>Was the invention developed under a Government Agreement or in conjunction with a Governmental laboratory, department, or agency? Please list any government development projects related to this invention. </p>
    <br/>
    <lightning:radioGroup name="myGovt" 
                          label=" "
                          options="{! v.Govt }"
                          value="{! v.GovtValue }"
                          type="radio"
                          />
    <br/>
    <p><b>Technical Review</b></p>
    <hr/>
    <br/>
    <p><b>Technical Reviewer(s):</b></p>
    <div> <b>In addition to patent committee, is there anyone who you would like to provide comments or feedback on your invention? </b><lightning:button class="customButton" variant="brand" aura:id="tech" label="Add" onclick="{! c.handleClick }" value="{!v.Technical}"/></div>
    <br/><br/>
    <p><b>Known Art</b></p>
    <hr/>
    <br/>
    <p><b>Known Art Attachments: </b></p>
    <br/>
    <p>Identify the closest or most relevant known art that you are currently aware of, including your own previously-filed patent applications. Please attach any known art documents below that you have. There is no need to do a search. </p>
    <br/>
    <div><b>Known Art (Publications and Patents) </b><lightning:button class="customButton1" variant="brand" aura:id="Art" label="Add" onclick="{! c.handleClick }" value="{!v.Art}"/></div>
    <br/><br/>
    <p><b>Inventor Comments</b></p>
    <hr/>
    <br/>
    <p><b>Inventor Comments:</b></p>
    <br/>
    <p>Please provide any additional comments you may have in the space provided. If you have no additional comments, please explicitly state NONE. </p>
    <br/>
    <div style="Width:1150px"><lightning:input name="input1" label=" " /></div>
    <br/><br/>
    <p>Once you have completed the entire IDF,  [  Print  ] out a final copy, and keep it for your record.</p>
    <hr/>
</aura:component>
Please need help on thisUser-added image
We have a certain case record type whose cases require a special auto-numbering system. This auto-number must be in the format of {YY}{0000}. The number in {0000} needs to reset to 1 every January 1. So, if the very first case this year is 200001, and the