• Dhilip Dussa
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 9
    Replies
Hi,

I'm facing one issue while inserting a record.

I have once Multi-select picklist,
if select anyone i need to create one more record with the same name

the first time it is inserting fine,
but if try next time getting an error
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Special Initiative: id value of incorrect type: a4D6C000000DMXJUA4

please help me,

List<Contact> mrl = new List<Contact>();

for(Integer i=0; i<wrapperList.size(); i++){
            System.debug('mkList===========>>>>>>'+mkList);
            Contact mr = new Contact();
            mr.name = wrapperList[i];
            mr.Account = wrapperList[i];
            mr.Opportunity__c = recordId;
            mrl.add(mr);
        }
        if(!mrl.isEmpty()){
            Insert mrl;
        }

I'm inserting name with accountId only

Thanks,
Dhilip
Hi,

I have one logic in that logic i'm returning values i'm return values are

{"available":
    {
        "a4C6C0000005rsWUAQ":"Account Test 1",
        "a4C6C0000005y14UAA":"Account Test 2",
        "a4C6C0000005s0rUAA":"Account Test 3"
    },

"hidden":{"a4D6C000000GycrUAC":"Account Test 4"}

}

I need to separate this lightning javascript 

I need to set "available" will be one attribute and
hidden will be in another attribute.

please help me

thanks,
Dhilip
Hi good morning,

I Need help on Salesforce JWT

I was done this to return Access token, after this i need to send any message to another Salesforce org can anyone please help me on this 

Thanks,
Dilip
Is there any way to hide total URL

Dilip commented on https://login.salesforce/browse/JIP-123: this test comment.

Here I need to display: Dilip this test comment.
can you please help me.

Note: Some times URL will be different like https://login.salesforce/browse/JIP-12345:

Thanks
Dilip
Good Morning,

Here I need to remove one line from the feed item

I can remove the specific sting by using string.remove('Test'); like this

but I need to remove one line
 
Example: 
This is the Raju's first comment, please check updated comment

in this, I need to remove 'This is the Raju's first comment' up to here

Note: here name will not same every time user can mention any name but starting and ending letters will be same every time
please help me,

Thanks,
Dhilip

Hi,

Here I have a requirement to set the record as a primary record

currently, I'm using case object in that case object I created a picklist field values are True and false

I create any new case I would be the primary record need to update remaining records false I did it but

i perform before update operation any record need to update that record as primary = true remaining records will be false anyone please help me on this, please

public class CaseController {
    
    public static Boolean isFirstTime = true;
    
    public Static void setPrimary(List<Case> caseList){
        for(Case c : CaseList){
            c.Primary__c = 'True';
        }
    }
    
    public Static void updatePrimary(List<Case> caseList){
        Set<Id> cIds = new Set<Id>();
        Set<Id> conIds = new Set<Id>();
        
        for(Case c : caseList)
        {            
            cIds.add(c.Id);
            conIds.add(c.contactid);
            
        }
        List<Case> cRecords = [Select Id,Primary__c,contactId From Case Where ContactId In :conIds];
        
        List<Case> cToUpdate = new List<Case>();
            for(Case c : cRecords)
            {
                if(!cIds.contains(c.Id))
                {
                    if(c.Primary__c=='True')
                    {
                        c.Primary__c = 'False';
                        cToUpdate.add(c);
                    }
                }
            }
         if (!cToUpdate.isEmpty()){
            update cToUpdate;
         }
        }
}

Hi,
I need some help on rest api, i'm not getting how to conver the
--data-urlencode

curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACe3cba3a08d9584987ecb9dc41946b15c/IncomingPhoneNumbers.json \ --data-urlencode "PhoneNumber=+15017122661" \ -u ACe3cba3a08d9584987ecb9dc41946b15c:your_auth_token

In endpoint i added the curl -X
anyone please help me

Thanks,
Hi,

Need help on returning value

I have created a site with vf page i need to return the values

the requirement i receive any message from thirdparty i need to show that

public class ControllerContacts{

   public Class wrapper{
        @AuraEnabled Public String Messages;
        @AuraEnabled Public String frmNumber;
        @AuraEnabled Public String currentpage;
    }
    @AuraEnabled
    public Static list<wrapper> init(){
        list<wrapper> wrapperList = new list<wrapper>();
        wrapper q = new wrapper();
        q.currentpage = ApexPages.currentPage().getParameters().get('MessageUUID');
        q.Messages = ApexPages.currentPage().getParameters().get('Text');
        q.frmNumber = ApexPages.currentPage().getParameters().get('From');
        wrapperList.add(q);
        system.debug('wrapperList========>>>>'+wrapperList);
        String fromNumber      = ApexPages.currentPage().getParameters().get('From');
        String text            = ApexPages.currentPage().getParameters().get('Text');
        
        IF(fromNumber != NULL && text !=NULL){
            SreeBolt__Twilio_Messages__c twilio = new SreeBolt__Twilio_Messages__c(SreeBolt__From_Number__c = '+'+fromNumber,SreeBolt__Message__c = text);
            insert twilio;
        }
        return wrapperList;
    }
}

=============================================================
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global" controller="ControllerContacts">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute type="List" name="Message"/>
    <aura:attribute type="List" name="Number"/>
    hello: {!v.Message}
    {!v.Number}
    <aura:iteration items="{!v.Message}" var="Msg">
        hello : {!Msg.Messages}
    </aura:iteration>
</aura:component>
=================================================================
({
    doInit : function(cmp, event, helper) {
        var action = cmp.get("c.init");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                cmp.set('v.Message', response.getReturnValue());
                cmp.set('v.Number', response.getReturnValue());
            console.log(cmp.get('v.Message'));
                console.log(cmp.get('v.Number'));
            }
        });
        $A.enqueueAction(action);
    }
})
Hi Everyone,

In need some help on command buttons

I created the text field and also created the button

if I enter any text and click on save button i need to disply the text
This is fine am able to the text

but i need to save it if i enter another text i need  both text values like n text values 

Thanks,
Dhilip
Hi,
I need Help on Test class with assert how to add assert in this test class

public class TestClass{
 @AuraEnabled
    public static Account returnAccount(Id ParentId) {
        return [Select Name, FirstName, LastName, Id from Account where id =: ParentId];
    }
    
    }
    ====================================================================
    @isTest
    public static void test(){
    Account a = new Account();
    a.Name='Test'
    insert a;
    
    TestClass.returnAccount(a.id);
    //need add assert here if I comment above line assert has to fail o/w it hass to pass
    }

Thanks
Hi,
I need help on displaying name
I need to display account records limit 10 by using lightning card 
I able to display this 10 records 
but I need to add one avather for every card account lastname firstletter and firstname firstletter 
anyone please help me on this
Thanks
This code is working fine but if i changed -91 to -90 r -92 then also one opportunity is creating can any one please fix this
    public static void insertOpportunity(list<OrderApi__Subscription__c> sub){
        
        set<id> ids = new set<id>();
        
        for(OrderApi__Subscription__c o : sub){
        
            ids.add(o.id);
        
        }
        
        
        list<Opportunity> op = new list<Opportunity>();

        for(OrderApi__Subscription__c o : [select id,OrderApi__Subscription_Plan__c,OrderApi__Days_To_Lapse__c,OrderApi__Contact__c,OrderApi__Contact__r.name,OrderApi__Item__c,OrderApi__Account__c from OrderApi__Subscription__c where id in : ids and (OrderApi__Item_Class__r.name='Silver Leader Membership' or OrderApi__Item_Class__r.name='Council Membership')]){
            
            if(o.OrderApi__Days_To_Lapse__c==-91){
                
                Opportunity opp = new Opportunity(Name=o.OrderApi__Contact__r.name,AccountId=o.OrderApi__Account__c,ContactId=o.OrderApi__Contact__c,StageName='Qualified',Type='Existing Business',CloseDate=system.today()+365,Probability=10);
                op.add(opp);
            }
        }
        
        if(op.size()>0){
        
            insert op;
        }
    }
===================================
if -91 hits i need to insert opportunity this one is working fine, if i updated -91 to any other number then also opportunity is creating please help me on this bug.
Hi all,

I have one field called address(Textarea long) if i gave address in second line need to auto populate in firstline with comma separated

And if anyone gave # in second line need to remove

Example 
Address: orus
                us.
Output:orus,us
Thanks
Hii..

create a user By using visualforce standard controller only
I need Apex and Visualforce\

Create Vf page for Salesforce users.
Add additional field Password
if I click on save button user has to be created with password
Note: No need sending email to the user emailid
Hey All,

I have Account and Contact objects with the custom field called Members(Text area long)

if I created list of contact record with Members fied inserting into Account Members fields with comma(,) its fine..

The requirement is by using batch apex need to update these fieds in Account Members with list of contact Member fieds with comma(,)

Thanks
Is there any way to hide total URL

Dilip commented on https://login.salesforce/browse/JIP-123: this test comment.

Here I need to display: Dilip this test comment.
can you please help me.

Note: Some times URL will be different like https://login.salesforce/browse/JIP-12345:

Thanks
Dilip
Good Morning,

Here I need to remove one line from the feed item

I can remove the specific sting by using string.remove('Test'); like this

but I need to remove one line
 
Example: 
This is the Raju's first comment, please check updated comment

in this, I need to remove 'This is the Raju's first comment' up to here

Note: here name will not same every time user can mention any name but starting and ending letters will be same every time
please help me,

Thanks,
Dhilip
Hii..

create a user By using visualforce standard controller only
Hello,
I want to create automatic opportuinty line item when opportunity is created. How is this possible. I want to create of particular Product name suppose "Accomodation". I have written a code. 
trigger insertOppLineItem on Opportunity (after insert, after update) {
 system.debug('****************InTrigger**********************');
    
    if(trigger.isAfter && (trigger.isInsert || trigger.isUpdate)){
        String OpportunityID ;
        
    for(Opportunity o : Trigger.new){ 
        system.debug('OpportunityID 8 -->'+o.Id);
        OpportunityID = o.Id;
    
        if(OpportunityID  != null) 
        {
            List<Opportunity> opp = [select Id , No_of_Nights__c from Opportunity where ID =:  OpportunityID  ]; 
               system.debug('Opportunity 14.......... -->'+opp );

          //  List<OpportunityLineItem> vList = new List<OpportunityLineItem >();
           for(OpportunityLineItem v : trigger.new){
            o.No_of_Nights__c = v.Quantity;
        
                //vList.add(v);          
             }
               

        } 
        upsert v; 
    }   
}
}


How is this achivable?


Thanks &Regards,
Utkarsha
Hi Folks,

I am looking for the functionality where I can have the trigger which will auto populate the Opp Line Item if I select the specific line item.

For example If I add the "ABC" Line item to the Opportunity, trigger will auto populate the another line Item "XYZ" to the same Opp.

I have one rough draft of the trigger which is not working:

trigger AutoCreateProduct on Opportunity (after insert) { 
    List<OpportunityLineItem> OpportunityLineItems = new List<OpportunityLineItem>(); 
    for (Opportunity newOpportunity: Trigger.New) { 
        if(newOpportunityLineItem == 'ABC'){
            OpportunityLineItems.add(new OpportunityLineItem(OpportunityId = newOpportunity.Id,PricebookEntryId ='01un00000000000',Quantity = 1,UnitPrice = 0)); (This should be the another Line Item "XYZ")

Experts please help me.

Thanks,
James
            
  
Hi All,

I am working on one scenario where there are Multiple Child Records for eg:Account is a parent and Under Account multiple child Objects Records will be there.In that child Object i have created one checkbox field called Primary and first record should be primary and if users adding another record as primary it has to thrwo error Message there is already one primary Record please unselect the existing record and add new record as primary marked
Eg:Let say under account 3 child records are there and 1 is primary already and user is trying to add the 3 rd record as primary it should throw error Message
NEXT There are 3 Multiple Child Records and one is primary among them and user is trying to delete the primary record without marking any other records as primary then it should throw error Message as User is trying to Delete primary Record without making another primary
If there is only one primary and user is trying to delete then it should allow the user to delete.
Note :Child Record Refers to Contact 
Any one please guide me to help to implement this scenarios.
I have install the twilio package and following components.How to configure the two components.When customer send an sms it not created an case in sandbox.Here I am unable to receive sms details.The twilio message url where should I give in the salesforce.

User-added image
I am completely new about twilio configuration.Can someone please help.
Whenever customer send an sms then it create an case in sandbox automatically by using twilio api .

**Component 1: Visual force Fage**

    <apex:page controller="TwilioRequestControllerContacts" action="{!init}" showHeader="false" sidebar="false">
        <center>
            <apex:pageBlock title="Twilio Request Listener"></apex:pageBlock>         
        </center>
    </apex:page>
**Component 2: Controller**

    public with sharing class TwilioRequestControllerContacts
    {
        public String fromNumber      = ApexPages.currentPage().getParameters().get('From');
        public String toNumber        = ApexPages.currentPage().getParameters().get('To');
        public String body            = ApexPages.currentPage().getParameters().get('Body');
        public PageReference init()
        {
        try
        {          
           System.debug('STEP 0 FROM: ==========>' + fromNumber);
           System.debug('STEP 1 TO: ===============>' + toNumber);
           System.debug('STEP 2 BODY: ==========>' + body);
           System.debug('STEP 3  ==============>');                
           String account = 'xxxxxxxxxxx';  
           String token = 'xxxxxxxxxxxx';
           TwilioRestClient client = new TwilioRestClient(account,token);
           system.debug('STEP 4 test==3>'+client);
           if(fromNumber != null && toNumber != null) { 
        //my own logic               
          Case ca = new Case(Subject = fromNumber,Description = body,Origin = 'Phone');
               INSERT ca;      
               RETURN null;
           }
        }               
       catch(exception e){
            system.debug('STEP 7 error ==========>'+e);
       }
        RETURN null;
       } 
    }