• Shiva Rajendran
  • NEWBIE
  • 418 Points
  • Member since 2015
  • Salesforce Developer


  • Chatter
    Feed
  • 6
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 25
    Questions
  • 168
    Replies
I am a beginner, I wrote this code to basically take two JSON POSTS and combine them I am getting a Save Error: Missing Return Statement Required return type string. My code is as follows, any help would be great! I have a return statement and it is a string so i'm not sure what I am missing. 
global with sharing class SendMCAwFiles {
  	global SendMCAwFiles (ApexPages.StandardController stdController)
  {
  }
  
  
 @RemoteAction
    global static String submittoMCAwDocs(List<Id>attachmentIds, String parentId, String mcaSubmissionID, String app_id,boolean allow_resubmit) {
    
    List<String> files = new List<String>();

    String documentUL_json;
    String response;
    MCA_Submission__c mcaSub = [SELECT Id,App_ID__c, Error_Message__c,FP_URL__c, Submission_Date_Time__c,FP_Username__c, FP_Password__c, Opportunity__c FROM MCA_Submission__c WHERE Id = :mcaSubmissionId];

    for (String attachmentId : attachmentIds) {
      documentUL_json = '';
      response = '';
      
      cg__OpportunityFile__c file = [SELECT Id, cg__File_Size__c, CreatedDate, MCA_Doc_Type__c, cg__Content_Type__c, cg__File_Name__c, MCA_File_Upload_Date__c FROM cg__OpportunityFile__c WHERE Id = :attachmentId];
      string fileURL = cg.SDriveTools.getAttachmentURL(parentId, attachmentId, 7200000);
      
      system.debug('UPLOAD FILE: ' + file.Id + ', URL: ' + fileURL);

        documentUL_json = MCAJSONUploadDocument.MCAJSONUploadDocument(
                mcaSub.FP_Username__c,
                mcaSub.FP_Password__c,
                mcaSub.Id,
                file.MCA_Doc_Type__c,
                file.cg__File_Name__c,
                fileURL
        );
     
    }
    
// now all documents that are attached are  stored withing the DocumentUL__Json string 

        if(mcaSub.App_ID__c != null && !allow_resubmit) {
        	
           system.debug('App has already been submitted.');
           
        } else {

            String jsonRequest=MCAJsonConstruct.MCAJsonConstruct(mcaSubmissionID);
            
            System.debug('MCA Json Request: ' + jsonRequest);
            
            Datetime currentDateTime = Datetime.now();
            String results;
            String DocwSub = documentUL_json + jsonRequest;
            
            try {
                Http httpProtocol = new Http();
		        HttpRequest request = new HttpRequest();
                request.setEndPoint(mcaSub.FP_URL__c+'submit_application with documents');
                request.setMethod('POST');
                request.setTimeout(120000);
                request.setHeader('Content-Type', 'application/json');
                //  set body to DowwSub which is the String for hte document attachment plus the Object.
                request.setBody(DocwSub);
                HttpResponse json_response = httpProtocol.send(request);
                String response2 = json_response.getBody();
                System.debug('MCA Json Response: ' + response);
               
				JSONParser parser =  JSON.createParser(response);
				
				string  IsError='';
				string  Message='';
				string  RowId='';

				//parser response  
                while (parser.nextToken() != JSONToken.END_OBJECT) {
                    if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
                        String text = parser.getText();
                        String fieldName = parser.getCurrentName();
                        if (parser.nextToken() != JSONToken.VALUE_NULL) {
                            if (text == 'IsError') {
                                IsError = parser.getText();
                            } else if (text =='Message') {
                                parser.nextValue();
                                Message = parser.getText();
                            } else if (text == 'RowId') {
                                RowId= parser.getText();
                            } else {
                                System.debug(response);
                            }
                        }
                    }
                }  // end while
               
                if(IsError == 'false') {
                    mcaSub.App_ID__c = RowId;
                    results = 'Send to MCA was: ' + Message;
                } else {
                    results = 'There was a problem: ' +  Message;
                    System.debug('PROBLEM: ' +  Message);
                }
                mcaSub.Submission_Date_Time__c = currentDateTime;
                mcaSub.Error_Message__c =  Message;

                update mcaSub;

            } catch(System.CalloutException e) {
                System.debug('FAILED: ' + e);
                results = 'ERROR: ' + e;
            }
            return results;
        }  // end if (mca.App_ID__c != null && !allow_resubmit)
    }  // end Pequalwdocs
       
  }

Hi, 

I want to Map a standard field value (Type String e.g. name) of each User (in users), in case it is not null or '',  with a standard SObject.

The DeveloperName of the SObject and the fieldvalue of the User are beeing the connection of these two. means DeveloperName =: user.fieldValue

But in order to refere to every User of users I would need to write this select inside the for loop and that is not a good way of writing a loop. 

How can I map the right name to the right SObject? Could please someone give me a hint? 

I have come to this result so far, but am very unsure if that is a valid solution:

public static boolean methodname (List <User> user, Map)
       Map <String, SObject> resultMap = new Map <String, SObject>();
       SObject so = [SELECT Id FROM SObject];
   
       for(User u : users){
            if(u.Name != null || u.Name != ' ' ){
                resultMap.put(u.name, so);
                   return true;
            }
        }
          return false;
}

 

Thank you in advance. 

Hi Team,

i am trying to get map<user, List<lead>>(), List of lead is records created by the user. I think query for getting related list will not work here.

How do i achieve this.

Thanks,

Manohar

Hi guys,
I'm trying here to get a PDF from SF page. Therefore, I am creating the page on visualforce. 
I am not a coder so I made the document on Word, saved as HTML and copied the code to my visualforce. 

However, it seems that the writing is not the same as I had to add quotes and end tags like <\meta>. I did all that and in the end, I got the error : element <o:p> not known.

So I tried with Google Sheets to download as HTML and same : I have to close all elements again.

Help! :p

Here is the error : line 6, column 3: The element type "meta" must be terminated by the matching end-tag "</meta>"
Error: The element type "meta" must be terminated by the matching end-tag "</meta>".

Here is my current code :
<apex:page standardController="Account" renderAs="pdf" applyBodyTag="false">
  <head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<style type="text/css">
@import url('https://themes.googleusercontent.com/fonts/css?kit=fpjTOVmNbO4Lz34iLyptLVumN3ATOVc2BoeDKcwJhFTljiSzuFEcjsip7pjNdcnF');ol{margin:0;padding:0}table td,table th{padding:0}.c13{border-right-style:solid;padding:0pt 5.8pt 0pt 5.8pt;border-bottom-color:#000000;border-top-width:0pt;border-right-width:0pt;border-left-color:#000000;vertical-align:top;border-right-color:#000000;border-left-width:0pt;border-top-style:solid;border-left-style:solid;border-bottom-width:0pt;width:261.4pt;border-top-color:#000000;border-bottom-style:solid}.c12{color:#000000;font-weight:700;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:"Adobe Fan Heiti Std B";font-style:normal}.c2{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:9pt;font-family:"Calibri";font-style:normal}.c6{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:11pt;font-family:"Calibri";font-style:normal}.c10{color:#000000;font-weight:400;text-decoration:none;vertical-align:baseline;font-size:12pt;font-family:"Calibri";font-style:normal}.c4{padding-top:0pt;padding-bottom:0pt;line-height:1.0;text-align:right;margin-right:-5.5pt}.c9{padding-top:0pt;padding-bottom:0pt;line-height:1.0;text-align:left}.c0{padding-top:0pt;padding-bottom:0pt;line-height:1.0;text-align:justify}.c5{margin-left:-5.8pt;border-spacing:0;border-collapse:collapse;margin-right:auto}.c8{font-size:9pt;color:#1155cc;text-decoration:underline}.c3{background-color:#ffffff;max-width:529pt;padding:28.4pt 40.5pt 70.8pt 42.5pt}.c7{color:inherit;text-decoration:inherit}.c1{height:11pt}.c11{height:134pt}.title{padding-top:24pt;color:#000000;font-weight:700;font-size:36pt;padding-bottom:6pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}.subtitle{padding-top:18pt;color:#666666;font-size:24pt;padding-bottom:4pt;font-family:"Georgia";line-height:1.0;page-break-after:avoid;font-style:italic;text-align:left}li{color:#000000;font-size:11pt;font-family:"Calibri"}p{margin:0;color:#000000;font-size:11pt;font-family:"Calibri"}h1{padding-top:12pt;color:#2f5496;font-weight:700;font-size:18pt;padding-bottom:0pt;font-family:"Cambria";line-height:1.0;page-break-after:avoid;text-align:left}h2{padding-top:2pt;color:#2f5496;font-weight:700;font-size:13pt;padding-bottom:0pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}h3{padding-top:14pt;color:#000000;font-weight:700;font-size:14pt;padding-bottom:4pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}h4{padding-top:12pt;color:#000000;font-weight:700;font-size:12pt;padding-bottom:2pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}h5{padding-top:11pt;color:#000000;font-weight:700;font-size:11pt;padding-bottom:2pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}h6{padding-top:10pt;color:#000000;font-weight:700;font-size:10pt;padding-bottom:2pt;font-family:"Calibri";line-height:1.0;page-break-after:avoid;text-align:left}</style>
</head>
<body class="c3">
<p class="c9 c1" id="h.gjdgxs">
<span class="c6">
</span>
</p>
<a id="t.43237f724b83829791a3600f5d7a15de7edeb72b">
</a>
<a id="t.0">
</a>
<table class="c5">
<tbody>
<tr class="c11">
<td class="c13" colspan="1" rowspan="1">
<p class="c0">
<span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 211.94px; height: 100.48px;">
<img src="https://c.eu4.visual.force.com/resource/1494428198000/Logo_2017" style="width: 211.94px; height: 100.48px; margin-left: -0.00px; margin-top: -0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title="">
</span>
</p>
<p class="c0">
<span class="c2">
Pleyad Pôle Business - Immeuble Pleyad 2</span>
</p>
<p class="c0">
<span class="c2">47 boulevard Ornano</span>
</p>
<p class="c0">
<span class="c2">93521 Saint Denis – France</span>
</p>
<p class="c0">
<span class="c2">Tel&nbsp;: +33 1 48 20 20 30</span>
</p>
<p class="c0">
<span class="c8">
<a class="c7" href="https://www.google.com/url?q=http://www.neofi-solutions.com&amp;sa=D&amp;ust=1494580227154000&amp;usg=AFQjCNG-79zmNmJ099Yk2AO5_V_zrntviA">www.neofi-solutions.com</a>
</span>
</p>
<p class="c0 c1">
<span class="c2">
</span>
</p>
</td>
<td class="c13" colspan="1" rowspan="1">
<p class="c4 c1">
<span class="c12">
</span>
</p>
<p class="c4 c1">
<span class="c12">
</span>
</p>
<p class="c4">
<span class="c12">FACTURE N°&nbsp;{!order.OrderNumber}</span>
</p>
<p class="c4">
<span class="c10">Date d’émission : {!Now()}</span>
</p>
</td>
</tr>
</tbody>
</table>
<p class="c9">
<span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 340.23px; height: 148.85px;">
<img src="https://c.eu4.visual.force.com/resource/1494436004000/Encadre_facture" style="width: 340.23px; height: 148.85px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title="">
</span>
<span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 340.23px; height: 148.85px;">
<img src="https://c.eu4.visual.force.com/resource/1494436004000/Encadre_facture" style="width: 340.23px; height: 148.85px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title="">
</span>
</p>
<p class="c1 c9">
<span class="c6">
</span>
</p>
<p class="c0 c1">
<span class="c2">
</span>
</p>
</body>
  </apex:page>
Thank you so much in advance !
 
Hi all,

I am trying to create a bullet point list in a table in Visualforce. See below for my current code. I would like bullet points where every time where I have noted ***.
 
<table style="float: left" border="0" cellpadding="8" cellspacing="0" width="100%">        
<tr >
<td width="50%">
<b><span style="font-size: 11pt;">Take your seat</span></b><br/>
Your space at&nbsp;<apex:outputText value="{!Proposal__c.Building__r.Name}"/>&nbsp;comes with everything you need to get started as soon as you move in - all included in the price:<br/>
<br/>
*** Office furniture package including desk and adjustable office chair.<br/>
<br/>
*** Telephony package including 2,000 minutes per month and a handset.<br/>
<br/>
*** High speed, fully inclusive internet package with optional upgrade to 100mb line.<br/>
<br/>
<b><span style="font-size: 11pt;">Join the&nbsp;<apex:outputText value="{!Proposal__c.Building__r.Name}"/>&nbsp;community</span></b><br/>
When you move into&nbsp;<apex:outputText value="{!Proposal__c.Building__r.Name}"/>, you get more than just workspace. You’ll be able to move into an active community made up of like-minded businesses.<br/>
<br/>
*** Customer Steering Group to give you a say in the running of the building.<br/>
<br/>
*** Community Engagement Manager to build the&nbsp;<apex:outputText value="{!Proposal__c.Building__r.Name}"/>&nbsp;community.<br/>
<br/>
*** Onsite customer service team.<br/>
<br/>
*** Regular programme of business, social and wellbeing events.
</td>
<td width="50%">
<b><span style="font-size: 11pt;">The Bruntwood Way</span></b><br/>
We prefer to think of ourselves as your property partner, not your landlord. When your business succeeds, our can too so that’s why we work hard to provide the best service possible.<br/>
<br/>
*** <b>Peace of mind</b><br/>
We own and manage all of our own buildings so you can be sure there will always be a member of the Bruntwood team on hand to help.<br/>
<br/>
*** <b>Flexibility</b><br/>
As your business grows you can move around the Bruntwood portfolio whenever you need more space - even if your current contract hasn’t ended.<br/>
<br/>
*** <b>Value for money</b><br/>
Managing our buildings ourselves means that we can often provide more cost effective solutions across our range of properties.<br/>
<br/>
*** <b>Responsible</b><br/>
From recycling to improving energy efficiency, we take our commitment to the protecting the environment seriously. We believe we are good people to do business with and always work with suppliers who are too.
                                  
</td>
</tr>                       

</table>
Any help would be greatly appreciated.

Thanks,

Paul
 
Here is my code:

trigger AggregateResult on Contact (after insert, after update) {

if((trigger.isinsert && trigger.isafter) || (trigger.isupdate && trigger.isafter))
{
contact c=trigger.new[0];
if(c.accountid!=null)
{

AggregateResult[] ar=[select SUM(Contact_Amount__c) ss from contact where accountid=:c.accountid];

Integer d=(Integer)ar[0].get('ss');

account ac=new account(id=c.accountid);
  ac.Total_Amount_of_Contacts__c=decimal.valueOf(String.valueOf(ar[0].get('ss')));
  update ac;
}
}

}

I want the sum of Amount field in Contact to appear on Account field. But I'm getting this error:
Apex trigger AggregateResult caused an unexpected exception, contact your administrator: AggregateResult: execution of AfterUpdate caused by: System.TypeException: Invalid conversion from runtime type Decimal to Integer: Trigger.AggregateResult: line 11, column 1

Please provide me a solution for this.
I got the following error on the second question in the above mentioned superbadge.
Challenge Not yet complete... here's what's wrong: 
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: EBBHWBTH
I used a fresh new developer org , after getting similar error in new trailhead playground org.
I really wonder why salesforce keep on realeasing new superbadge while the debug on error throwing is so bad, feeling very bad about the superbadge experience error notification of salesforce.
Thanks,
Shiva RV
The salesforce if it involves too much coding ,then i noticed lot of complexities in the code whenever the salesforce updates some of its featues, i would like to know why would someone go for hardcore customization in salesforce instead of choosing  java and heroku? In this case ,their are quite a lot of advantages like
1: no limits as in salesforce
2: licenses are cheap so if the user count is high , it will profitable in the long run
3: No need to have dependency on the existing functionality which may mess with the functionality required.( i have personally been through this, where an existing functionality completely complicated the custom development required)
4: And also need not concern the code breaking because of any standard functionality changes in salesforce ( i have been through this when creating the dynamic thread id in salesforce ,it crashes at some time and no guarante will it work later)

Do share your thoughts to it.

Thanks and Regards,
Shiva RV
Hi everyone,
I have to escalate an case based on time entry. I mean after 5mins the case must be escalated in case rule entry
I have used the formula
((NOW() -CreatedDate)>= 0.00044)
The case entry always fails since the escalation rule is calculated only during the creation time.
Is there any way i can make the escalation rule to fire at 5mins of case creation.
I have also attached a 30mins timed escalation action to the escalation rule.If the rule passes in 30 mins the escalation happens.
Any suggestion on it?
Is it possible to do a soap callout to org 2 from org 1 using javascript in salesforce .
I mean by there exists a soap or rest webservice in org 2, i must write javascript code to access its response in org 1.
I know it is possible using apex and visualforce,just want to confirm its feasibiltiy using javascript
I got the Following Error on the last module even when i tried with a new sfdc developer org.

Challenge Not yet complete... here's what's wrong: 
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: FMZJJISKUser-added image
Hello Everyone,
I have a component , which creates lightning:button dynamically in iteration. Could i get all the buttons created in the js controller by some logic?
I just want to disable one button out of the 25 dynamically created button.

Cmp:
 
aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" controller="LightningBingoBoardCreatedAuraClass">
<aura:attribute name="BoardClass" type="LightningArrayWraperClass[]">    </aura:attribute>

    <aura:attribute name="chosenValues" type="String[]">    </aura:attribute>

   <aura:iteration items="{!v.BoardClass}" var="item">
        <lightning:layout horizontalAlign="space">

                   <aura:iteration items="{!item.arrayClass}" var="inneritem">
                    
                       
       <lightning:layoutItem flexibility="auto" padding="around-small">
       <div aura:id="{!inneritem.value}">
           <lightning:button variant="neutral" label="{!inneritem.value}" onclick="{! c.buttonClickEventFire }" />
                       </div>
       </lightning:layoutItem>
                       
       </aura:iteration> 
       </lightning:layout>
 <lightning:button variant="neutral" label="clear all" onclick="{!c.buttonClear}"/>

Basically there are 25 buttons with unique labels to it. I just want to disable the button based on the value entered in a text box which matches the button label. I just want to know how to get all the buttons present inside the component from js controller code
 
buttonClear:function(component,event,helper)
    {
                var button = component.find({ instancesOf : "ui:button" });
    button.set("v.label", "test");
        alert(button);
     var com=component.get("v.LightningArrayWraperClass.BoardClass");
   
}
/*   var button = component.find({ instancesOf : "ui:button" }); this code didnt work ,the button was always null

Any help is greatly welcomed.

Thanks and Regards,
Shiva RV
Hello ,

I have a controller  with one variable in it.When the command button is clicked . js function is called which alert the apex controller variable. The command button increments the variable of apex, but the js always alerts the value set in the apex controller constructor value. No idea why? Do i miss any basic feature of salesforce inregard with accessing variable of apex in js?

Vf page :
 
<apex:page controller="ReRenderIssueController_CC">
    <script>
    function clickButton()
    {
        var s="{!JSENCODE(Stringii)}";
        alert("hello "+{!Stringii} +"  " +{!ii});
        alert(s);
        }
    </script>
    <apex:form>
    <apex:outputPanel id="iiComp">
    {!ii}
       </apex:outputPanel> 
        <apex:commandButton onclick="clickButton();" value="Save" action="{!save}" reRender="iiComp" title="click to reRender"/>
    
    </apex:form>
</apex:page>



Controller 
 
public class ReRenderIssueController_CC {
    public integer ii{get;set;}
    public String Stringii{set;}
    
    public String getStringii()
    {
        return String.valueOf(ii);
        
    }
    
    public ReRenderIssueController_CC()
    {
        ii=2;
        
    }
    
    public pageReference save()
    {
        ii++;
        return null;
           
    }
    
}
I always get value 2,2 in js while the vf page gets changed to 2,3 and so on, based on user click on the button.

Any help will be welcomed.

Thanks and Regards,
Shiva RV

 
I have tried the Build a Discount Calculator traillhead.I followed the steps as given in the trailhead. I got the below error.

Challenge Not yet complete... here's what's wrong: 
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: WUNARPLY
So i did the same steps again in a new trailhead org but still got the same above mentioned error with different error id. Want to know how to find a solution to this in trailhead?
 
I just want a clarity on transaction in salesforce. I want answers for the following questions :
1 : Suppose i have a vf page , so according to salesforce all that's happening on this page is considered as one transaction?
2 : Unless i have loaded a new vf page ,every per transaction limit is valid for the same vf page?
3 : If till loading a new vf page is considered as transaction and the per transaction limit is valid ,then can i reload the page to avoid per transaction limitation?
4 : If a user has 2 buttons , onclick of it an soql and dml query is made , then if the user clicks the button for 150 times ,then soql exception will happen? and will all those are taken as a single transaction? I mean then all changes would get rolled back?

please do clarify me on those topics.

Thanks and Regards,
Shiva RV  
A user can have up to 50 query cursors open at a time. For example, if 50 cursors are open and a client application still
logged in as the same user attempts to open a new one, the oldest of the 50 cursors is released. Note that this limit is
different for the batch Apex start method, which can have up to five query cursors open at a time per user. The other
batch Apex methods have the higher limit of 50 cursors ? Cursor limits for different Database.com features are tracked separately. For example, you can have 50 Apex query cursors and 50 batch cursors open at the same time.
what does cursor in here means ?? Does it represents the soql query which means i can't make more than 50 soql query inside execute method each time?
Also what does 50 apex query curssor and 50 batch cursor open mean by exactly?
Thanks and Regards,
Shiva RV
I want to know if this is possible in salesforce.Lets say i have an formula field and validation rule in account object. 
I want to know if based on certain condition i can modify another field inside the formula field or validation rule.
Like if (name=='drug')
 isValidRecord=false;
If user enters name as drug on account object,then on insertion the isValidRecord checkbox should be checked using validation rule or formula field.Is it possible using these?
Thanks and Regards,
Shiva RV
 
I want to know about the preparation and skills required to clear the platform developer 2 certification in salesforce. I'm 2 years experienced in salesforce.

Thanks and Regards,
Shiva RV
I have two orgs org1 and org2 . i want to create a vf page and controller in org1 which will display all the accounts present in org2 , let me know how it is possible?

Thanks and Regards,
Shiva RV
The js code that call the apex function is 
function validate()
{
    //  alert("here");
     username=j$('[id$=email]').val();
    
        alert("here ");

    password=j$('[id$=pass]').val();
    // alert(username + "  " +password);
    
 if((username=='') || (password==''))
     {
      document.getElementById("hello").innerHTML="username or password is null";
      return false;   
         }
             
  
   var result= apiToolKitToGetAllCustUser();
    if(result==1)
        {
  alert("in result 1");
            pageRedirectAF(2); // it is the vf actionFunction
             
         }   
            return false;
    }

The vf page code is as follows
 
<button type="submit" class="btn btn-default" onclick="return validate();">login</button>
      <apex:actionFunction action="{!pageRedirectFn}" name="pageRedirectAF">
            <apex:param name="pageData" id="pageData" value="3" assignTo="{!pageData}"/>

     </apex:actionFunction>

Apex Code is as follows :
 
public class custLogin_CC {
    
    public String username{get;set;}
    public String password{get;set;}
    List<CustomUser__c> allUsers{get;set;}
    public Integer pageData{get;set;}
    
    public custLogin_CC()
    {
        
        allUsers=[select Mid__c,password__c,userEmail__c,userName__c from CustomUser__c];
        //pageData=2; if i uncomment this ,it works strangely
        
        
    }
    
    public PageReference pageRedirectFn()
    {
                PageReference pg=null;
           String s= system.CurrentPageReference().getParameters().get('pageData');
                System.debug('pageredirect function called '+ pageData +'   ss ' + s);

        if(pageData==1)
                        pg=new PageReference('/apex/IF_AllQuestionPage_Vf');
        else
                                    pg=new PageReference('/apex/IF_createQuestion_Vf');

        return pg;
        

            
    }
}

Inside constructor in apex class , at line number 12 , if i uncomment the code , the pageData is always 2 at  the pageRedirectFn function. If i comment that line ,then things are working fine.IThe value i pass through the js is auto assigned to the pageData. I want to know if pageData(ie the param variable in vf) shouldn't be initialised if used in param?
I just need to know why it behaves in this way?

Thanks and Regards,
Shiva RV

 
I used a standard list controller for account object . There are around 500 records in the db. But on the page i found only 20 records . i need to know why only 20 records is shown at the page, Also the code worked when i used custom controller. I shall attach the code i used below
<apex:page standardController="account" recordSetVar="acc" >
        <apex:panelGrid columns="5" id="theGrid">

    <apex:repeat value="{!acc}" var="a">
        {!a.id}    <br/>
        {!a.name}
      
    </apex:repeat>
    </apex:panelGrid>
</apex:page>


 
i have a custom login page . How can i align to look like salesforce login ?
<apex:page controller="custLogin_CC" showHeader="false" sidebar="false"> 
    
    <apex:form >
    <apex:pageblock >
        <apex:pageBlockSection >
               username : <apex:inputText value="{!username}"/>
              </apex:pageBlockSection>
        <apex:pageBlockSection > 
        <br/>
            password : <apex:inputSecret value="{!password}"> </apex:inputSecret>
        
       </apex:pageBlockSection> 
       
       
            
        
        <apex:commandButton action="{!login}" value="login" style="float:centre" />
      </apex:pageblock>  
    </apex:form>
</apex:page>
User-added image
What should i do to display label and inputfield together in salesforce?
Thanks and Regards,
Shiva RV
 
It is inregard with the Recruitment , i have 3 object , Position ,Employee website and Job Posting ,where Job Posting is a junction object of Position  and Employee website. I want to know how to make Position object to have a related list of Employee website . i tried to change the layout on position object and found that Employee website is not at all comming on the related list category. Let me know what i have to do to make it possible.

Note :
Position has no relation with Employee website
Job Posting is junction object between Postion and Employee Website
Hi Everyone,
I have followed the procedure to access the rest api by registering app in  https://apps.dev.microsoft.com . But when i'm making a callout for oauth authorize using the following url 
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=32613fc5-e7ac-4894-ac94-fbc39c9f3e4a&redirect_uri=https:%2f%2foauthplay.azurewebsites.net%2f&scope=openid+offline_access+profile+https:%2f%2foutlook.office.com%2fmail.readwrite+https:%2f%2foutlook.office.com%2fmail.readwrite.shared+https:%2f%2foutlook.office.com%2fmail.send+https:%2f%2foutlook.office.com%2fmail.send.shared+https:%2f%2foutlook.office.com%2fcalendars.readwrite+https:%2f%2foutlook.office.com%2fcalendars.readwrite.shared+https:%2f%2foutlook.office.com%2fcontacts.readwrite+https:%2f%2foutlook.office.com%2ftasks.readwrite

I'm getting status code as 200 instead of 302.Also at further notice , response.getBody() is returning html rather json , also the same get method code work's if i used in browser.
Http http1 = new Http();
        HttpRequest request1 = new HttpRequest();
request1.setEndpoint('https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=32613fc5-e7ac-4894-ac94-fbc39c9f3e4a&redirect_uri=https:%2f%2foauthplay.azurewebsites.net%2f&scope=openid+offline_access+profile+https:%2f%2foutlook.office.com%2fmail.readwrite+https:%2f%2foutlook.office.com%2fmail.readwrite.shared+https:%2f%2foutlook.office.com%2fmail.send+https:%2f%2foutlook.office.com%2fmail.send.shared+https:%2f%2foutlook.office.com%2fcalendars.readwrite+https:%2f%2foutlook.office.com%2fcalendars.readwrite.shared+https:%2f%2foutlook.office.com%2fcontacts.readwrite+https:%2f%2foutlook.office.com%2ftasks.readwrite');
  request1.setMethod('GET');
  HttpResponse response = http1.send(request1);

        System.debug('****'+response.getBody()   );
        System.debug('****  '+response.getStatusCode() );

Please help me with links and solutions
Thanks and Regards,
Shiva RV

 
I need to create a validation rule for a object , The validation rule should check if the filled text field value contain the value that is valid for a picklist already present . ie : there are two fields ,one text field t1 and picklist p1 with values (v1,v2,v3) at object level . I want to verify if user entered data on text field t1 as one among the value present in picklist p1. Let me know if this can be done through validation rule itself ? I know it is possible through apex code , but my current requirement is to do it through validation rule. Please do share your knowledge

Thanks and Regards,
Shiva RV
In here first i call  boardInitialisation function and in that the boardObj is not null on debug , when i call the function boardObjectId through js controller ,both the static field boardObj, boardId become null .Why is it happening , doesn't the static object value persist between different function?

public class LightningBingoSetupAuraClass {

  @AuraEnabled
    public static Board_Object__c boardObj{get;set;}
  @AuraEnabled
    public static Id boardId{get;set;}
    

@AuraEnabled
public static User getUser() {
// Perform isAccessible() check here
     User  vuser;

System.debug('in debug' + userinfo.getUserId());
    vuser=[select id,name from user where id=:userinfo.getUserId()][0];
    System.debug(vuser.name+' '+vuser.id);
      return vuser;
}
 @AuraEnabled   
    public static List<Single_Box__c> boardInitialisation(Id playerId,String playerType)
    {
        System.debug('playerId  '+playerId + ' Player type  '+ playerType);
         boardObj=new Board_Object__c() ;
        insert  boardObj ;
        System.debug('board obj id in board initialisation ' + boardObj);
         boardId= boardObj.Id;
   

     List<Id> boxesId=new List<Id>();
        boxesId=boxInitialisation(boardObj);
        System.debug('boxes id total '+ boxesId.size());
        
       
        System.debug('board id '+boardId);
        System.debug('boardObj id is '+ boardObj.Id);

    
        
               

      
      
        
    }

    @AuraEnabled   
     public static String boardObjectId()
     {
         System.debug('in Box Object Id' + boardObj);
        
                  System.debug('in Box Object Id' + boardId);

         if(LightningBingoSetupAuraClass.boardObj==null)
             return 'it is null';
         
         return String.valueOf(LightningBingoSetupAuraClass.boardObj.Id);
     }
    
The salesforce if it involves too much coding ,then i noticed lot of complexities in the code whenever the salesforce updates some of its featues, i would like to know why would someone go for hardcore customization in salesforce instead of choosing  java and heroku? In this case ,their are quite a lot of advantages like
1: no limits as in salesforce
2: licenses are cheap so if the user count is high , it will profitable in the long run
3: No need to have dependency on the existing functionality which may mess with the functionality required.( i have personally been through this, where an existing functionality completely complicated the custom development required)
4: And also need not concern the code breaking because of any standard functionality changes in salesforce ( i have been through this when creating the dynamic thread id in salesforce ,it crashes at some time and no guarante will it work later)

Do share your thoughts to it.

Thanks and Regards,
Shiva RV
The salesforce if it involves too much coding ,then i noticed lot of complexities in the code whenever the salesforce updates some of its featues, i would like to know why would someone go for hardcore customization in salesforce instead of choosing  java and heroku? In this case ,their are quite a lot of advantages like
1: no limits as in salesforce
2: licenses are cheap so if the user count is high , it will profitable in the long run
3: No need to have dependency on the existing functionality which may mess with the functionality required.( i have personally been through this, where an existing functionality completely complicated the custom development required)
4: And also need not concern the code breaking because of any standard functionality changes in salesforce ( i have been through this when creating the dynamic thread id in salesforce ,it crashes at some time and no guarante will it work later)

Do share your thoughts to it.

Thanks and Regards,
Shiva RV
I am having an custom filed x in child object if it is null and user is updating stage value on opportunity it needs to throe error. And I wrote below error and it is throwing error Sobject rows not allow errors

trigger UpdateOpp on Opportunity (before update) 
{
//Set<ID> oppid = new Set<ID>();
List<Id> oid = new List<ID>();
for(Opportunity opp:trigger.old)
{
oid.add(opp.id);
}

List<Opportunitylineitem> oppl = [select id, name, offerings__c from opportunitylineitem where Offerings__c = null AND opportunityId IN:oid];

for(opportunity opp1:trigger.old)
{
for(OpportunityLineItem opp:oppl)
{
if(opp.offerings__c==null)
{
opp.addError('Please update Opportunityproduct');
}
}
}
Hi everyone,
I have to escalate an case based on time entry. I mean after 5mins the case must be escalated in case rule entry
I have used the formula
((NOW() -CreatedDate)>= 0.00044)
The case entry always fails since the escalation rule is calculated only during the creation time.
Is there any way i can make the escalation rule to fire at 5mins of case creation.
I have also attached a 30mins timed escalation action to the escalation rule.If the rule passes in 30 mins the escalation happens.
Any suggestion on it?
I have related list called "Approvers" in opportunity object.

And I created few dummy records in approvers.

I am trying to fetch all those related list record associated with opportunity in apex trigger. As I wannted to assign values to the picklist field in realted list depend on Oppotunity pickist field value

For eg : Select all approvers where opportunity id="some-id";

Any suggestion would be really appreciated.
Hi 

I have scnerio where I need to capture IP address of current User in Lightning Community, is any way standard way  where I can capture IP address inside Lightning Components.
I have seen third party tools like - https://www.ipify.org/ to get Ip address 
Any recommendations are appreciated 

Thanks 
I am a beginner, I wrote this code to basically take two JSON POSTS and combine them I am getting a Save Error: Missing Return Statement Required return type string. My code is as follows, any help would be great! I have a return statement and it is a string so i'm not sure what I am missing. 
global with sharing class SendMCAwFiles {
  	global SendMCAwFiles (ApexPages.StandardController stdController)
  {
  }
  
  
 @RemoteAction
    global static String submittoMCAwDocs(List<Id>attachmentIds, String parentId, String mcaSubmissionID, String app_id,boolean allow_resubmit) {
    
    List<String> files = new List<String>();

    String documentUL_json;
    String response;
    MCA_Submission__c mcaSub = [SELECT Id,App_ID__c, Error_Message__c,FP_URL__c, Submission_Date_Time__c,FP_Username__c, FP_Password__c, Opportunity__c FROM MCA_Submission__c WHERE Id = :mcaSubmissionId];

    for (String attachmentId : attachmentIds) {
      documentUL_json = '';
      response = '';
      
      cg__OpportunityFile__c file = [SELECT Id, cg__File_Size__c, CreatedDate, MCA_Doc_Type__c, cg__Content_Type__c, cg__File_Name__c, MCA_File_Upload_Date__c FROM cg__OpportunityFile__c WHERE Id = :attachmentId];
      string fileURL = cg.SDriveTools.getAttachmentURL(parentId, attachmentId, 7200000);
      
      system.debug('UPLOAD FILE: ' + file.Id + ', URL: ' + fileURL);

        documentUL_json = MCAJSONUploadDocument.MCAJSONUploadDocument(
                mcaSub.FP_Username__c,
                mcaSub.FP_Password__c,
                mcaSub.Id,
                file.MCA_Doc_Type__c,
                file.cg__File_Name__c,
                fileURL
        );
     
    }
    
// now all documents that are attached are  stored withing the DocumentUL__Json string 

        if(mcaSub.App_ID__c != null && !allow_resubmit) {
        	
           system.debug('App has already been submitted.');
           
        } else {

            String jsonRequest=MCAJsonConstruct.MCAJsonConstruct(mcaSubmissionID);
            
            System.debug('MCA Json Request: ' + jsonRequest);
            
            Datetime currentDateTime = Datetime.now();
            String results;
            String DocwSub = documentUL_json + jsonRequest;
            
            try {
                Http httpProtocol = new Http();
		        HttpRequest request = new HttpRequest();
                request.setEndPoint(mcaSub.FP_URL__c+'submit_application with documents');
                request.setMethod('POST');
                request.setTimeout(120000);
                request.setHeader('Content-Type', 'application/json');
                //  set body to DowwSub which is the String for hte document attachment plus the Object.
                request.setBody(DocwSub);
                HttpResponse json_response = httpProtocol.send(request);
                String response2 = json_response.getBody();
                System.debug('MCA Json Response: ' + response);
               
				JSONParser parser =  JSON.createParser(response);
				
				string  IsError='';
				string  Message='';
				string  RowId='';

				//parser response  
                while (parser.nextToken() != JSONToken.END_OBJECT) {
                    if (parser.getCurrentToken() == JSONToken.FIELD_NAME) {
                        String text = parser.getText();
                        String fieldName = parser.getCurrentName();
                        if (parser.nextToken() != JSONToken.VALUE_NULL) {
                            if (text == 'IsError') {
                                IsError = parser.getText();
                            } else if (text =='Message') {
                                parser.nextValue();
                                Message = parser.getText();
                            } else if (text == 'RowId') {
                                RowId= parser.getText();
                            } else {
                                System.debug(response);
                            }
                        }
                    }
                }  // end while
               
                if(IsError == 'false') {
                    mcaSub.App_ID__c = RowId;
                    results = 'Send to MCA was: ' + Message;
                } else {
                    results = 'There was a problem: ' +  Message;
                    System.debug('PROBLEM: ' +  Message);
                }
                mcaSub.Submission_Date_Time__c = currentDateTime;
                mcaSub.Error_Message__c =  Message;

                update mcaSub;

            } catch(System.CalloutException e) {
                System.debug('FAILED: ' + e);
                results = 'ERROR: ' + e;
            }
            return results;
        }  // end if (mca.App_ID__c != null && !allow_resubmit)
    }  // end Pequalwdocs
       
  }

My controller is

public class c4
{
Account [] selectedacts;
public Account [] getselectedacts()
{
return selectedacts;
}
public PageReference showall()
{
selectedacts=[select Name, Type, Phone, Fax, Industry from Account];
return null;
}

public PageReference direct()
{
selectedacts=[select Name, Type, Phone, Fax, Industry from Account where Type='Customer - Direct'];
return null;
}

Public PageReference channel()
{
selectedacts=[select Name, Type, Phone, Fax, Industry from Account where Type='Customer - Channel'];
return null;
}

}

Hi Gurus, 

Is it possible Io go from one Visualforce page to another without using an apex class?

so basically after my form is saved by a user, I want to go to a "thank you" page that I have created. However, I dont want to use an apex class.

Please if you know how I can do so, please let me know, thanks!
Hi All,

Getting the below error when i click on quick action containing a lightning component. 
Action failed: forceChatter:lightningComponent$controller$doInit (undefined is not an object (evaluating 'fn-apply')]

quickActionHandlerHelper.js failed to create component - forceChatter:lightningComponent

Let me know what the issue could be.
We need a freelance SF developer that can develop and implement our lead to quote process. Travel Industry experience is a plus. We have existing data schema and workflow mapping. etc. Developer must be proficient in Force.com pages, web to lead Apex, Visual Force, IDE, migration tools, Web Services, third party API Integration. This is the first phase of our project. We are looking to develop an ongoing relationship with a freelance developer.
  • October 20, 2010
  • Like
  • 0
Hi.
I have big Visualforce page, and now I tried to use insertRow / insertCell to make dynamic table.

First of all, I tested it on test table.
I made button that call make row function.

However, whenever I click button, the new row appears, and dissapear soon. for 0.2~0.3sec.

Why do this dissapear? How do I avoid it?

Please help.