• Mahendra Singh 19
  • NEWBIE
  • 35 Points
  • Member since 2015
  • Software Developer
  • Kloudrac software pvt ltd

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 8
    Replies
Hi All,

Please help me with below request.

I want to calll a apex method from my javaScript

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
<apex:actionFunction action="{!MyMethod}" name="myFunction" />
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         MyFunction();
        }
    </script>
</apex:page>


Controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
            System.debug('I am called ILU');
        return null;
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I want to call Mymethod() from controller from Java Script.

Kindly help

Regards
Karthic Sankar V P
I want to move order from SAP to salesforce. When order created in SAP moved to salesforce . All fields data received at salesforce side except one auto number fields (order number). we are able to pass static order id but can't sytem generated id.


How can i resolve this issue ?
public with sharing class CaseDetails {
    
    public List<Solution> lstSolution= new List<Solution>();
    public List<CaseComment> lstComment = new List<CaseComment>();
    public List<EmailMessage> lstEmails = new List<EmailMessage>();
    public List<attachment> lstattachment = new List<attachment>();
    public boolean displayPopUp{get;set;} // set Variable for pop up show hide
    public boolean displayPopUp2{get;set;}  // set Variable for pop up show hide 
    //public List<attachment> lstattachment2 = new List<attachment>();
    //public String[] countries = new String[]{};
    public Id objId;
    User objUser = new User();
    public boolean isGoogle { get; set; }
    public boolean isShow {get;set;}
    public boolean isEdit {get;set;}
    public ID caseID;
    public Case objCaseNew{get;set;}    
    PUBLIC STRING STREMAIL{GET;SET;}
    public string priorityValue {get;set;}
    List<string> searchInfo = new List<string>();
    List<Solution> solutionList = new List<Solution>();
    Contact objContact {get;set;}
    private string priorityPriorValue ;
    public string priorityReason {get;set;}
    public boolean panalView{get;set;} 
 
    public CaseDetails(ApexPages.StandardController stdController) {
    try{
     //CaseID = ApexPages.currentPage().getParameters().get('id');
      // objCaseNew  = new Case();
        isShow =false;
        isEdit = true;
        
        
        
        objContact = new Contact();
        objUser = [select ContactId from User where id =:UserInfo.getUserId()];
        
        
        objContact = [select name,phone,email,AccountId,Account.Name from Contact where Id =: objUser.ContactId];
        
        if(objContact.Account.Name.toLowerCase().contains('google')){
           isGoogle = true;
        }
        else{
           isGoogle = false;
        }
         objId = ApexPages.currentPage().getParameters().get('id');
         this.objCaseNew = (Case)stdController.getRecord();
         if(objId!=null)
         {
           objCaseNew  =[select id,CC_Email_Ids__c,Division__c,Priority,Priority_Change_Reason__c from Case where id=:objId];
           priorityReason = objCaseNew.Priority_Change_Reason__c;
           //panalView=true;
           STREMAIL = objCaseNew.CC_Email_Ids__c ;
           
           //priorityValue = objCaseNew.priority;
           //priorityReason = objCaseNew.priority;
           priorityPriorValue = objCaseNew.priority;
           
        /*if(objCaseNew.Priority_Change_Reason__c!=null)
        {
        
        panalView=true;
        
        }else{
        
         panalView=false;
        
        }
        */
           
           
         }
         //panalView=false;
         system.debug('objCaseNew___'+objCaseNew); 
        }Catch(Exception ee){}
     }
     
     
   
    
    
    public void openpopup()
    {
    //displayPopUp = true;
        if( priorityPriorValue =='P4' && ( objCaseNew.priority == 'P3' || objCaseNew.priority == 'P2'|| objCaseNew.priority == 'P1') ){
        objCaseNew.TAC_Engineer__c = 'Unassigned';
        displayPopUp = true;
        }
        
        if(priorityPriorValue =='P3' && (objCaseNew.priority == 'P2'|| objCaseNew.priority == 'P1') ){
        objCaseNew.TAC_Engineer__c = 'Unassigned';
        displayPopUp = true;
        }
        
        if(priorityPriorValue =='P2' && objCaseNew.priority == 'P1' ){
        objCaseNew.TAC_Engineer__c = 'Unassigned';
        displayPopUp = true;
        }
        
    }
    
    public void continuepopup()
    {
        displayPopUp = false;
        displayPopUp2 = true;
    }
    
    public List<CaseComment> getComments() {
        system.debug('case details');
        lstComment = [SELECT CommentBody, CreatedDate, CreatedById FROM CaseComment WHERE ParentId =: objId ORDER BY CreatedDate desc];
        return lstComment;
    }
    
   public List<EmailMessage> getEmails() {
        system.debug('Email details');
        lstEmails = [SELECT Status, Subject,FromAddress,MessageDate,TextBody,htmlbody FROM EmailMessage WHERE ParentId =: objId ORDER BY Messagedate desc];
        return lstEmails;
    }
    public PageReference NewComment() {
        if(objCaseNew!=null)
        {
        PageReference PgRefNewComment = new PageReference('/apex/CommentsPage?CaseID='+objCaseNew.ID);
        PgRefNewComment.setRedirect(true);
        return PgRefNewComment;
        }else{
        return null;
        }
    }
                
    public List<WrapperClassSS> getAttachments() {       
       if(templist.size() == 0){
           for(attachment a: [SELECT id,name,CreatedById,Owner.name,BodyLength,CreatedDate FROM Attachment WHERE ParentId =: objId ORDER BY CreatedDate desc] ){
                WrapperClassSS templ = new WrapperClassSS();                
                if(integer.valueof(a.BodyLength) < 1024 ){
                    templ.BLength = string.valueof(a.BodyLength)+'bytes';
                }
                else if(integer.valueof(a.BodyLength) <= 1048576 ){
                    if((math.mod(integer.valueof(a.BodyLength),1024) < 512))
                        templ.BLength = string.valueof(a.BodyLength/1024)+'KB';
                    else
                        templ.BLength = string.valueof((a.BodyLength/1024)+1)+'KB';
                }
                else if(a.BodyLength > 1048576 ){
                    System.debug('===attachment length with two decimal places==='+(decimal.valueof(a.BodyLength)/1048576).setscale(2));
                    string attsize = string.valueof((decimal.valueof(a.BodyLength)/1048576).setscale(2))+'MB';
                    if(attsize.contains('.0'))
                        templ.BLength = attsize;
                    else if(attsize.contains('.00'))
                        templ.BLength = string.valueof(a.BodyLength/1048576)+'MB'; 
                    else
                        templ.BLength = string.valueof((decimal.valueof(a.BodyLength)/1048576).setscale(1))+'MB';                       
                }   
                
                templ.att = a;
                templist.add(templ);           
            }
        }
         System.debug('List of attachments'+lstAttachment);
         return templist;
    }
    list<WrapperClassSS> templist = new list<WrapperClassSS>();
    public class WrapperClassSS{        
        public string BLength{set;get;}        
        public attachment att{set;get;}        
    }
    
    public void EditMode()
    {
       system.debug('MethodCall');
       objCaseNew  =[select id,CC_Email_Ids__c,Division__c,TAC_Engineer__c,Priority,Priority_Change_Reason__c from Case where id=:objId];
       priorityPriorValue = objCaseNew.priority;
       if(objId!=null)
       {
        isShow = true;
        isEdit = false;
       }
       
    }
    
    public void SaveData()
    {     
        displayPopUp2 = false;
        displayPopUp = false;
        isShow = false;   
        isEdit = true;
        string priorityval; 
     try{
            if(objCaseNew.CC_Email_Ids__c!=null){
                List<string> lstEmail=new List<string>();
                if(objCaseNew.CC_Email_Ids__c.contains(';')){
                    lstEmail=objCaseNew.CC_Email_Ids__c.split(';');
                }else if(objCaseNew.CC_Email_Ids__c.contains(',')){
                    lstEmail=objCaseNew.CC_Email_Ids__c.split(',');
                }
                if(lstEmail.size()>0){
                    for(integer i=0;i<lstEmail.size();i++){
                        if(i==0)
                        objCaseNew.CC_Email_Id__c=lstEmail[i];
                        else if(i==1)
                        objCaseNew.CC_Email_Id2__c=lstEmail[i];
                        else if(i==2)
                        objCaseNew.CC_Email_Id3__c=lstEmail[i];
                    }
                }else{
                    objCaseNew.CC_Email_Id__c=objCaseNew.CC_Email_Ids__c;
                }
                               
            }
         priorityReason = objCaseNew.Priority_Change_Reason__c;
         system.debug('**********objCaseNew.Priority111**********'+objCaseNew.Priority);  
         update objCaseNew; 
         system.debug('**********objCaseNew.Priority222**********'+objCaseNew.Priority);
       }
       catch(Exception ex) {
            apexpages.addmessages(ex);
            return;
        }                      
    }
    
    
    
    public void cancel(){
    isShow = false; 
    objCaseNew.Priority=priorityPriorValue ;        
    }
    
    public void cancelPopUp(){ 
    displayPopUp2 = false;
    displayPopUp = false; 
    objCaseNew  =[select id,CC_Email_Ids__c,Division__c,TAC_Engineer__c,Priority,Priority_Change_Reason__c from Case where id=:objId];
        
    objCaseNew.Priority=priorityPriorValue ;     
    }
    
    
   
}


 
It is working fine with all records but create this error for one Id,  altough that id exist in DB.
Hi All,

Please help me with below request.

I want to calll a apex method from my javaScript

<apex:page controller="ViewQAAMController">
<apex:form >
<apex:pageBlock >

<apex:pageBlockTable value="{!BadgeList}" var="data" align="center" styleClass="table table-striped" >
<apex:column headerValue="MyValues">
<apex:outputLink value="{!data['Week__c']}" onclick="openWindow()">{!data['Week__c']}</apex:outputLink>
</apex:column>
</apex:pageBlockTable>
<apex:actionFunction action="{!MyMethod}" name="myFunction" />
</apex:pageBlock>
</apex:form>
<script>
function openWindow(){
         window.open('/apex/AddQAAMWeeklyPlanner');
         MyFunction();
        }
    </script>
</apex:page>


Controller:

public class ViewQAAMController {

    public PageReference MyMethod() {
            System.debug('I am called ILU');
        return null;
    }


    //public List<AggregateResult> BadgeList { get; set; }
   
    public List<AggregateResult> BadgeList
  {
      get
      {
          List<AggregateResult> badges = [select Week__c, max(createddate) apple from QAAM_Weekly_Planner__c Max group by Week__c order by max(createddate) desc LIMIT 10];
          return badges;
      }
      set;
  }
    
   }

I want to call Mymethod() from controller from Java Script.

Kindly help

Regards
Karthic Sankar V P
I'm learning salesforce and sometimes struggle with overthinking validation rules. If two values are the same - the checkbox must be checked. Can someone enlighten me, please?
Hi everyone, 

I'm trying to understand all concept behind Einstein Language, after having generated a Dataset and having trained it to AI, I was trying some "intent" call, with mixed words.

The documentation talks about a Feedback and ReTrain, so that if you get a label in an intent call, that it's not related to the words you put into the call, you will be able to retrain AI, but when I make again the same call (after training is SUCCEDED) I don't get a better probability or the right label as it should be after having sent a feedback to AI.

Just a small overview of wich steps I walked through:
  • Upload Dataset
  • Train Dataset first Time
  • Intent Call
  • Send feedback (this step with the feedback call the new row should be added to the dataset right?)
  • ReTrain
  • Intent Call
Thanks.
Hi Friends ,

I having a urgent issue , please help me ..... I want to enable the country picklist in my account vf page , I have already enabled in my sandbox and it was visible in other object like Contact , but not on VF . Please let me know if you have any question regarding this .
Please reply soon .

Id : gvishwakarma@kloudrac.com
I need to delete a Wave Dataset(s) but I can't do that because the dataset is associated with a Dataflow.

Thus, I need to delete the Dataflow; however, I'm unable to do so??

There are no instructions for doing so and one unable to upload a blank json file to replace the existing Datflow?

I need help with this specifically, since the datasets put me over my storage limit and prevent completion of other Trailhead trainings.  However, more generally there should be a simple delete Dataflow function, as other users have mentioned.
what i doing now is,i have written custom webservice and gave to sap team.we are planning connect salesforce system using  SSL certificate for mutual authentication.
my question is how to pass the certificate parameter with in custom webservices?
becoz they do not want use login credencials and other thing is SAP side there is no option to parse our WSDL.
so how to handshake our system through CUSTOM WSDL?

HI Every one,

 

    I have a visualforce page and corresponding apex class like this

<apex:page standardController="Event__c" extensions="CreateAnEvent">
...code.........
...code.........
</apex:page>

 Now I want to call a method in apex class, from JavaScript function.Can any one have any idea. Can you please help me in this requirement.

 

Thanks,

Naresh