• vamsi krishna 106
  • NEWBIE
  • 15 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 10
    Replies
I am not able to see SenderEmail Field on the User object pagelayout. but i can see SenderEmail on object level , Please help me to what configuration i missed.

Thanks
Vamsikrishna
 
When user update a record(update will done by community user).Same record can view by multiple internal  users. whoever is viewing the that record i need to show alert or toaster to those user.

any suggestons.

Thanks
Vamsikrishna B.
Contact has open and i have batch class which update the same contact when bacth apex class updated then i need to refresh the contact details page. Either by using Lightning component or any other 

Any suggestions?

Thanks
Vamsikrishna B.
var recordId = cmp.get("v.recordId");
       var Fields = { ToAddress: {value: "to@to.com"}, 
                     ParentId	: {value: recordId}, 
                     HTMLBody: {value: "the text body", insertType: "cursor"} }
        var args = {actionName :"Case.Send_Email"};
        actionAPI.selectAction(args).then(function(result){
            console.log('Available Fields are ', JSON.stringify(result));
            //actionAPI.invokeAction(args);

        }).catch(function(e){
            if(e.errors){
                console.log('Action Field Log Errors are ',e.errors);
                console.error('Full error is ', JSON.stringify(e));
            }

try to using the "quickActionAPI" and gettting the 

below error "We can’t execute the API because the parent record isn’t selected."
Calling the Quickaction from lightning component and it's not working. please let me if i am doing anything wrong..

Thanks in advance.Full Screen
I have trigger and fr om that trigger i am exectuing the @future method. I have enabled the BULK Api  on the Data loader and then try to loading the  data.At this time trigger is exectuing but @future method is not executing.Please help me guys.What is the reason for this problem or is there any alternative solution to do this.

Thanks in advance.
Regards
VamsiKrishna B
Error:
User-added image

Code:
User-added image

I am not sure what's error on related to above code.Thanks in advance.

Thanks
Vamsikrishna B
 
Hi guys ,
i am getting the following error only on mozila firefox and it's working fine in IE,Edge,Chrome.but i am not able to figure it out.Can u please help me on this.
Error on Mozila

Thanks in advance..

 
I have queue,See below screen.
User-added image

and in the queue i have role, now i need to get the users based on that role ,please help me
 I tried like below 
select Id, type from Group where type='Queue' AND Name='Customer Service Director'
and see the result below
User-added image
Select Id,UserOrGroupId,GroupId,Group.type,Group.relatedid From GroupMember where GroupId='QueueId'

User-added image
but in the queue i have role not group i am getting the Group id(Please check the prefix of userorGroupid ,it's staring with 00G(Prefix of group)).Please help me to get the Roles from Queue,thanks in advance.
 
Hi Folks,
Now i am doing somehting related to the barcode scanning by using decodeworker.js it's working fine in all browsers except google chrome and the code was taken from http://bobbuzzard.blogspot.in/  this blog please help and or let me know the issue please..
thanx in advance...  
Hi Guys
Please help me
i took the code from bobbuzzard.blogspot.in and i saved it then i run it,

.i am getting error while choose barcode file  then it's not preview,after that i open the developer console of browser at there it showing resource(image) is not found.
<apex:page applyHtmlTag="false" showheader="false" sidebar="false" controller="BarcodeSF1Ctrl2">
    <head>
        <title>BarcodeReader</title>
        <apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.core.css')}"/>
        <apex:stylesheet value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/themes/alertify.default.css')}"/>
        <apex:includeScript value="{!URLFOR($Resource.alertify, 'alertify.js-0.3.11/lib/alertify.min.js')}"/>
    </head>
    <body>
        <div>
        <img width="320" height="240" src="" id="picture" style="border:10px groove silver" />
        </div>
        <input id="Take-Picture" type="file" accept="image/*;capture=camera"/>
        <p>If the picture looks clear, click the button to decode</p>
        <button onclick="DecodeBar();">Decode</button>
        <p id="textbit"></p>
        <button id="navigate" style="visibility:hidden;" onclick="navigate();">Go to record</button><br/>
        <button style="width:100%" onclick="window.location.reload();">Restart</button>
        <script type="text/javascript">
            var startTime;
            var interval;
            var recordId;
        
            var takePicture = document.querySelector("#Take-Picture"),
            showPicture = document.querySelector("#picture");
            
            Result = document.querySelector("#textbit");
            Canvas = document.createElement("canvas");
            Canvas.width=640;
            Canvas.height=480;
            var resultArray = [];
            ctx = Canvas.getContext("2d");
            
            showPicture.onload = function(){
           
                    ctx.drawImage(showPicture,0,0,Canvas.width,Canvas.height);
                  };
                  
            var workerCount = 0;
            
            // function called when a worker has finished decoding (or failed!)
            function receiveMessage(e) {
            
                // capture how long this has taken
                var elapsedTime=new Date() - startTime;
                if(e.data.success === "log") {
                    console.log(e.data.result);
                    return;
                }
                workerCount--;
                if(e.data.success){
                
                    // stop the "working" messages
                    clearInterval(interval);
                    var tempArray = e.data.result;
                    for(var i = 0; i < tempArray.length; i++) {
                        if(resultArray.indexOf(tempArray[i]) == -1) {
                            resultArray.push(tempArray[i]);
                        }
                    }
                    Result.innerHTML=resultArray.join("<br />") + '<br/>Decoded in ' + elapsedTime + ' milliseconds';
                    
                    // notify the user of the success
                    alertify.success('Decoded barcode');
                    
                    // execute the controller method to figure out the Salesforce account record
                    alertify.log('Retrieving record');
                    
                    BarcodeSF1Ctrl2.getRecordFromBarcode(resultArray[0], recordRetrieved, {escape: false})
                     
                }else{
                    // if all workers have finished and there are no results, tell the user we failed
                    if(resultArray.length === 0 && workerCount === 0) {
                    
                        // stop the "working" messages
                        clearInterval(interval);
                        Result.innerHTML="Decoding failed in " + elapsedTime + ' milliseconds';
                        
                        // notify the user of the failure
                        alertify.error('Unable to decode');
                        
                    }
                }
            }
            var DecodeWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");

            var RightWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");

            var LeftWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");

            var FlipWorker = new Worker("{!URLFOR($Resource.DecodeWorker)}");

            DecodeWorker.onmessage = receiveMessage;
                
            RightWorker.onmessage = receiveMessage;
                
            LeftWorker.onmessage = receiveMessage;
                
            FlipWorker.onmessage = receiveMessage;
                
            if(takePicture && showPicture) {
                takePicture.onchange = function (event) {
                    var files = event.target.files
                    if (files && files.length > 0) {
                        file = files[0];
                        try {
                            var URL = window.URL || window.webkitURL;
                            var imgURL = decodeURI(URL.createObjectURL(file));
                            showPicture.src = imgURL;
                            URL.revokeObjectURL(imgURL);
                        }
                        catch (e) {
                            try {
                                var fileReader = new FileReader();
                                fileReader.onload = function (event) {
                                    showPicture.src = event.target.result;
                                };
                                fileReader.readAsDataURL(file);
                            }
                            catch (e) {
                                Result.innerHTML = "Neither createObjectURL or FileReader are supported";
                            }
                        }
                    }
                };
            }
            function DecodeBar(){
                    // start the timer for the decoding
                    startTime=new Date();
                    Result.innerHTML="";
                    resultArray = [];
                    workerCount = 4;
                    // notify the user something is happening
                    alertify.log('Launching workers');
                    
                    // start the interval timer to output a message every 5 seconds
                    interval=setInterval(function(){alertify.log('Still working');},5000);
                    
                    DecodeWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "normal"});
                    RightWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "right"});
                    LeftWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "left"});
                    FlipWorker.postMessage({pixels: ctx.getImageData(0,0,Canvas.width,Canvas.height).data, cmd: "flip"});
            }
            
            // callback method when the record has been retrieved from the controller
            function recordRetrieved(result, event)
            {
             if ( (!event) || (event.status) ) 
                {
                    if (-1!=result.indexOf('Error'))
                    {
                        alertify.error(result);
                    }
                    else
                    {
                        // notify the user and render the button
                        alertify.success("Found account");
                        document.querySelector("#navigate").style.visibility='visible';
                        recordId=result;
                    }
                }       
                else if (event.type === 'exception')
                {
                    alertify.error(result);
                }
            }
            
            // method invoked when the user clicks the 'Go to record' button - determines whether we are in
            // Salesforce1 world and carries out the appropriate navigation
            function navigate()
            {
                            
                if ( (typeof sforce != 'undefined') && (sforce != null) ) 
                {
                    sforce.one.navigateToSObject(recordId);
                }
                else 
                {
                    window.location="/" + recordId;
                }        
            }
        </script>
    </body>
</apex:page>
Please check the above code and let me know the what error i did.;please very urgent to me and  thanks in advance..
 
When i click on button  it performing the Action(Apex Class Method).
on that i am getting this error..and i gave the WITHOUT SHARING to class at the same Object does nothave edit permission on that time i need to do do all CRED operatins..Please give solution or suggetions to solve it..

Thanks in advance..

Regard's
Vamsi Krishna
var lastvalue=1;
var pricecheckid='#pricecheckselected#*'+lastvalue;
<apex:form>
<apex:checkbox value="true" id="pricecheckselected#*1" />

<apex:checkbox value="true" id="reordeselected#*1" />

</apex:form>


reordeselected#*1(this is also dynamic value)
 pricecheckselected#*1(this is dynamic value).now when i click on another check reordeselected#*1 i need disable  pricecheckselected#*1 this check box..please help me
now i want pricecheckid variable and some checkbox have same id like pricecheckid variable.now i want use this variable and need to disable that check box and need to uncheck that checkbox by using jquery..please help me..or give me some suggestions on it..
thanks in advance..

Regard's
Vamsi
i have list ..after inserting that list i want get that all id's of that list records..is it possible ..please give some suggesstions...

thanks in advance

Regard's

Vamsi Krishna..

pagereference parentpage=new pagereference('/'+id);
i tried like above and below
 
return new ApexPages.StandardController(oldtisdetails).view();

both are not working please help me..
/*
Created By : VamsiKrishna
Description: This is related to the TUR(Tissue Utilization Record) Versioning.This will Run when u click on Version  
Custom Buttion and It show the editable VF page if that tissue have the active TUR and now if u edit that TUR it create the new TUR and existing one is in in-active.
otherwise it show one new form to Create the new tur Related to that tissue.
*/
public without sharing class SBWEBVersioningCLS
{
   public string contactname{get;set;}
    public id contactid{get;set;}
    public string Patient_Last_Name{get;set;}
    public string Patient_First_Name{get;set;}
    public string PatientDOB{get;set;}
    public string Pending{get;set;}
    public string Pendings{get;set;}
    public string Procedure_Code_1{get;set;}
    public string Procedure_Code_2{get;set;}
    public string Procedure_Date{get;set;}
    public string Procedure_Type{get;set;}
    public string Genders{get;set;}
    public string Procedure_Type_Comments{get;set;}
    public string Comments{get;set;}
    public string Sources{get;set;}
    public tissue__c tis{get;set;}
    public tissue__c oldtisdetails{get;set;}
    public TUR__c tur{get;set;}
    public Boolean isMobile{get;set;}
    public id turid;
                public SBWEBVersioningCLS(ApexPages.StandardController controller) {
                    this.oldtisdetails=(tissue__c )controller.getRecord();
                    //Here we are fetching the Active TUR detials
                       //list<TUR__c>();
                        tur=new TUR__c();
                       tis=new tissue__c();
                        try{
                        tis=[SELECT id,name from Tissue__c WHERE id=:oldtisdetails.id];
                            tur=[SELECT id,Tissue__c,Surgeon_Name__r.name,Surgeon_Name__r.id,Source__c,Gender__c,Active__c,Surgeon_Name__c,Patient_First_Name__c,Patient_Last_Name__c,Procedure_Code_1__c,
                                 Procedure_Code_2__c,Procedure_Date__c,Procedure_Type__c,Procedure_Type_Comments__c,PatientDOB__c,Pending__c,
                                 Comments__c FROM TUR__c WHERE Active__c=true AND tissue__c=:oldtisdetails.id];
                           }catch(exception e){}
                           if(tur!=NULL){
                             //for(TUR__c tr:tur){
                              Sources=tur.Source__c;
                              Comments=tur.Comments__c ;
                              Procedure_Type_Comments=tur.Procedure_Type_Comments__c;
                              Genders=tur.Gender__c;
                              Procedure_Type=tur.Procedure_Type__c;
                              //Procedure_Date=string.valueof(tr.Procedure_Date__c);
                              if(tur.Procedure_Date__c!=NULL){
                              String strProDate=string.valueof(tur.Procedure_Date__c);
                              String[] arrProDate = strProDate.split('-');
                              Procedure_Date=arrProDate[1]+'/'+arrProDate[2]+'/'+arrProDate[0];
                              }
                              Procedure_Code_2=tur.Procedure_Code_2__c;
                              Procedure_Code_1=tur.Procedure_Code_1__c;
                              Pendings=tur.Pending__c;
                              if(tur.PatientDOB__c!=NULL){
                               String strPDOB=string.valueof(tur.PatientDOB__c);
                              String[] arrpDOB = strPDOB.split('-');
                             PatientDOB=arrpDOB[1]+'/'+arrpDOB[2]+'/'+arrpDOB[0]; 
                            } 
                             Patient_First_Name=tur.Patient_First_Name__c;
                             Patient_Last_Name=tur.Patient_Last_Name__c;
                             //PatientDOB=tr.PatientDOB__c;
                             contactname=tur.Surgeon_Name__r.name;
                             contactid=tur.Surgeon_Name__c;
                          //}
                      }
                      if(String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) || String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin'))){
                           isMobile = true;
                      }else{isMobile = false;}
            }
            public List<SelectOption> getProducerType(){
                   List<SelectOption> pTypes= new List<SelectOption>();
                   Schema.DescribeFieldResult ptypeResult =TUR__c.Procedure_Type__c.getDescribe();
                   List<Schema.PicklistEntry> ptypeList = ptypeResult.getPicklistValues();
                   for( Schema.PicklistEntry Tpt : ptypeList)
                   {
                      pTypes.add(new SelectOption(Tpt.getLabel(), Tpt.getValue()));
                   }       
                   return pTypes;
               }
             public list<SelectOption> getgender(){
             List<SelectOption> gender= new List<SelectOption>();
             Schema.DescribeFieldResult genderResult =TUR__c.Gender__c.getDescribe();
                   List<Schema.PicklistEntry> genderList = genderResult .getPicklistValues();
                   for( Schema.PicklistEntry gen: genderList )
                   {
                      gender.add(new SelectOption(gen.getLabel(), gen.getValue()));
                   }       
                   return gender;
             }
             public list<SelectOption> getpendingNEw(){
             List<SelectOption> pendingss= new List<SelectOption>();
             Schema.DescribeFieldResult PendResult =TUR__c.Pending__c.getDescribe();
                   List<Schema.PicklistEntry> pendList = PendResult.getPicklistValues();
                   for( Schema.PicklistEntry pen:pendList )
                   {
                      pendingss.add(new SelectOption(pen.getLabel(),pen.getValue()));
                   }       
                   return pendingss;
             }
             public list<SelectOption> getSource(){
             List<SelectOption> Source= new List<SelectOption>();
             Schema.DescribeFieldResult SourceResult =TUR__c.Source__c.getDescribe();
                   List<Schema.PicklistEntry> SourceList = SourceResult.getPicklistValues();
                   for( Schema.PicklistEntry sou: SourceList )
                   {
                      Source.add(new SelectOption(sou.getLabel(), sou.getValue()));
                   }       
                   return Source;
             }
            @RemoteAction 
      Public static string surgenName(string con){
      
               string qstring = con+'%';
               string resultstring='';
               list<contact> srchconlist =new list<contact>();
                srchconlist = [select id,name from contact where name like:qstring];
                    if(!srchconlist.isEmpty()){
                       for(contact co : srchconlist){
                              resultstring+=co.name+'%'+co.id+'#';
                               }
                           }else{
                           resultstring='No Records';
                           }
                       return resultstring;
                     }
//This is used to save the records related to the TUR..
        public pagereference CreateTUR(){
        pagereference parentpage=new pagereference('/'+oldtisdetails.id);//It redirect the page to the Parent Record Details Page based on the Tissue id
          
           system.debug('oldtisdetails@@@'+tur);
           if(String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) || String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin'))){
             isMobile = true;
            }else{isMobile = false;}
           TUR__c newtur=new TUR__c();
           newtur.Tissue__c=oldtisdetails.id;
           newtur.Patient_Last_Name__c=Patient_Last_Name;
           system.debug('contactid@@'+contactid);
            system.debug('contactname@@'+contactname);
           if(contactname==NULL){
           contactid=NULL;
           }
           newtur.Surgeon_Name__c=contactid;
           newtur.Patient_First_Name__c=Patient_First_Name;
           if(PatientDOB!='' && PatientDOB!=NULL){
           String  dbdt=PatientDOB;
           newtur.PatientDOB__c=date.parse(PatientDOB);
           }
           newtur.Pending__c=Pendings;
           newtur.Procedure_Code_1__c=Procedure_Code_1;
           newtur.Procedure_Code_2__c=Procedure_Code_2;
           if(Procedure_Date!='' && Procedure_Date!=NULL){
           newtur.Procedure_Date__c=date.parse(Procedure_Date);
           }
           newtur.Procedure_Type__c=Procedure_Type;
           newtur.Gender__c=Genders;
           newtur.Procedure_Type_Comments__c=Procedure_Type_Comments;
           newtur.Comments__c =Comments ;
           newtur.Source__c=Sources;
           try{
           system.debug('newtur###'+newtur);
           insert newtur;//Inserting the TUR
            if(tur!=NULL){
               //tur.id=turid;
                
               //tur[0].Active__c=false;//In-active the Old TUR
               tur.Active__c=false;
               update tur;//Updating the Old TUR.
            }
                System.Debug('Is it Mobile?? '+isMobile+' Record Id@@'+oldtisdetails.id);
                 if(isMobile==false){
                 parentpage.setRedirect(true);
                    return parentpage; //It redirect the page to the Parent Record Details Page
                }else{
                    return null;// It is for Mobile redirection
                 }  
                }catch(DMLException de){
                     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Error'+de));
                     return null;
                }
                  
  }
}
<!--
Name:SBWEBVersionButton
Created By : VamsiKrishna
Description: Creating the TUR(Tissues Utilization Record) based on the Tissue.
Modifications:Mobility
-->
<apex:page standardController="Tissue__c" extensions="SBWEBVersioningCLS" sidebar="false" docType="html-5.0">
  <head>
    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
    <script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
  <apex:stylesheet value="{!URLFOR($Resource.SLDS0110, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
  <!--TURVersion CSS Resource--->
              <apex:stylesheet value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/TURVersion.css')}" />
              <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/calendar/calendar_blue.css')}" />
               <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/CBCSS/jquery.mobile.datepicker.css')}" />
                <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/CBCSS/jquery.mobile.datepicker.theme.css')}" />
              <apex:stylesheet value="http://code.jquery.com/mobile/git/jquery.mobile-git.css" /> 
            <!--Jquery Resource CDN-->
              <apex:includeScript value="//code.jquery.com/jquery-1.11.3.min.js"  />
                <apex:includeScript value="http://code.jquery.com/mobile/git/jquery.mobile-git.js"  />
                <apex:includeScript value="//code.jquery.com/jquery-migrate-1.2.1.min.js"  />
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
               <!--Jquery Resource CDN End-->
              <apex:includeScript value="{!URLFOR($Resource.CBCSS,'CBCSS/calendar/calendar.js')}"/>
              <apex:includeScript value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/TURversionJs.js')}"/>
                  <apex:includeScript value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/datepicker.js')}"/>
              <script src="//code.jquery.com/jquery-1.10.2.js"></script>
              <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
              <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
               <link rel="stylesheet" href="https://jqueryui.com/jquery-wp-content/themes/jqueryui.com/style.css"/>
               <link rel="stylesheet"  href="http://code.jquery.com/mobile/git/jquery.mobile-git.css" /> 
               <style>
               #ui-datepicker-div{
               width:300px;
              }
               .overlay {
                    background-color:#000;
                    position: absolute;
                    left: 0;
                    top: 0;
                    width: 100%;
                    height: 100%;
                    opacity:0.3;
            }
               </style>
              <script type="text/javascript">
        $(function(){
              $(function(){
                $("[id$='pdob']").datepicker({ maxDate: 0 , dateFormat: 'mm/dd/yy' }).on('changeDate', function(ev){
                    $('#sDate1').text($('#pdob').data('date'));
                    $('#pdob').datepicker('hide');
                });
               })
            })
             $(function(){
              $(function(){
                $("[id$='producerDate']").datepicker({ maxDate: 0 , dateFormat: 'mm/dd/yy' }).on('changeDate', function(ev){
                    $('#sDate1').text($('#pdob').data('date'));
                    $('#producerDate').datepicker('hide');
                });
               })
            })
            $(function () {
            $("[id$='pfirstname']").keydown(function (e) {
            if (e.shiftKey || e.ctrlKey || e.altKey) {
            e.preventDefault();
                    } else {
                    var key = e.keyCode;
                        if (!((key == 8) || (key == 32) || (key == 46) || (key >= 35 && key <= 40) || (key >= 65 && key <= 90))) {
                    e.preventDefault();
                    }
                }
                });
                });
                
                 $(function () {
            $("[id$='plastname']").keydown(function (e) {
            if (e.shiftKey || e.ctrlKey || e.altKey) {
            e.preventDefault();
                    } else {
                    var key = e.keyCode;
                        if (!((key == 8) || (key == 32) || (key == 46) || (key >= 35 && key <= 40) || (key >= 65 && key <= 90))) {
                    e.preventDefault();
                    }
                }
                });
                });
        function pdobvalidation(){
        var date=$("[id$='pdob']").val();
        var inputDate = new Date(date);
        var finalDate=inputDate.setHours(0,0,0,0);
        var today = new Date();
        var finaltoday=today.setHours(0,0,0,0);
        if(finalDate>finaltoday){
        $("[id$='IMDateErorr']").text("Patient Date of Birth must not be future Date");
                    
        return false;
        }else{
        $("[id$='IMDateErorr']").text("");  
        $("#finalerror").text("");  
        }
        }
         function producerDatevalidation(){
        var date=$("[id$='producerDate']").val();
        var inputDate = new Date(date);
        var finalDate=inputDate.setHours(0,0,0,0);
        var today = new Date();
        var finaltoday=today.setHours(0,0,0,0);
        if(finalDate>finaltoday){
        $("[id$='IMDateErorr2']").text("Procedure Date must not be future Date");            
        return false;
        }else{
        $("[id$='IMDateErorr2']").text("");
        $("#finalerror").text("");    
        }
        }
           
          function savingTUR(){
        
        var surgenname= $("[id$='contactnamenew']").val();
        var contactid=$("[id$='contactidnew']").val();
        if(surgenname==''){
         var surgenVal='';
        $("[id$='contactidnew']").val(surgenVal);
        }else if(surgenname && contactid==''){
        $("#contactiderorr").text("Please Select Proper Surgen Name");
        return false;
        }
        var error1=$("#IMDateErorr").text();
        var error2=$("#IMDateErorr2").text();
        var error3=$("#contactiderorr").text();
       if(error1.length==0 && error2.length==0 && error3.length==0){
         $("#finalerror").text("");
        $(".overlay").show();
        savingTURDetail();
        }else{
        $("#finalerror").text("Please check the Errors");
        return false;
         }
       }
           
        </script>
          <script> 
        function goBacktoParent() { 
            Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
        }
    </script>

  </head>
<body>

  <div class="slds">
  <apex:form >
  <apex:actionFunction action="{!CreateTUR}" name="savingTURDetail"  oncomplete="goBacktoParent();" status="sts" immediate="true"/>
    <div class="maindiv">
         <div class="divclass">
             <span class="spanone"><label><b>Tissue Name</b></label></span>
              <span class="spantwo"><apex:outputField value="{!tis.name}"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Surgeon Name</b></label></span>
              <span class="spantwo">
              <apex:inputText html-autocomplete="off"  id="contactnamenew" value="{!contactname}" onkeyup="gensurgenname.call($(this));" styleClass="slds-input" style="max-width:300px" />
               <div id="contactiderorr" style="color:red"></div>
               <div class="drpdwnlist"></div>
          </span>
         </div>
       <div class="divclass">
              <span class="spanone"><label><b>Patient First Name</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Patient_First_Name}" id="pfirstname" styleClass="slds-input" style="max-width:300px" />
             </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Patient Last Name</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Patient_Last_Name}" id="plastname" styleClass="slds-input" style="max-width:300px"/>
              </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Patient DOB</b></label></span>
              <span class="spantwo">
            <apex:inputText id="pdob" size="10" styleClass="slds-input"  value="{!PatientDOB}" style="max-width:300px" onkeyup="return pdobvalidation();"/>
            
            <div id="IMDateErorr" style="color:red"></div>
            </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Gender</b></label></span>
              <span class="spantwo">
              <apex:selectList id="gender" value="{!Genders}"  size="1" styleClass="slds-input" style="max-width:300px">
                <apex:selectOptions value="{!gender}" />
               </apex:selectList>
              </span>
         </div>
         <br/>
         <div class="divclass">
             <span class="spanone"> <label><b>Procedure Type</b></label></span>
              <span class="spantwo">
              <apex:selectList id="procedureType" value="{!Procedure_Type}"  size="1" styleClass="slds-input" style="max-width:300px">
               <apex:selectOptions value="{!ProducerType}"/>
               </apex:selectList></span>
         </div>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Type Comments</b></label></span>
              <span class="spantwo"><apex:inputTextarea value="{!Procedure_Type_Comments}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Date</b></label></span> 
              <span class="spantwo"><apex:inputtext style="max-width:300px" styleClass="slds-input" size="10" id="producerDate"  value="{!Procedure_Date}" onkeyup="return producerDatevalidation();" />
                  <div id="IMDateErorr2" style="color:red"></div>
              </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Code(1)</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Procedure_Code_1}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Code(2)</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Procedure_Code_2}" styleClass="slds-input" style="max-width:300px"/></span>
         </div> 
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Comments</b></label></span>
              <span class="spantwo"><apex:inputTextarea value="{!Comments}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <div class="divclass">
               <span class="spanone"><label><b>Pending</b></label></span>
              <span class="spantwo">
              <apex:selectList id="pending" size="1" value="{!Pendings}" styleClass="slds-input" style="max-width:300px">
                  <apex:selectOptions value="{!pendingNEw}"/>
              </apex:selectList></span>
              
         </div>
         <div class="divclass">
               <span class="spanone"><label><b>Source</b></label></span>
              <span class="spantwo">
              <apex:selectList value="{!Sources}" size="1" styleClass="slds-input" style="max-width:300px">
                  <apex:selectOptions value="{!Source}"/>
              </apex:selectList>
              </span>
         </div>    
         <apex:inputText value="{!contactid}"   id="contactidnew" />
         <div id="finalerror" style="color:red"></div>
         <div class="divclass">
              <apex:commandButton value="Save"  onclick="return  savingTUR();"  styleClass="btnclck">
              </apex:commandbutton>
             <div> <apex:pagemessages /></div>
         </div>
        </div>
  </apex:form>
  </div>
  <div class="overlay" style="display:none">
     <center><apex:image url="{!$Resource.Saving_Icon}" height="50" width="50" style="top:45%; left:45%;position: absolute;"  /></center>
    </div>
  </body>
   
</apex:page>

please give me why i am not getting values when i edit the previous data values.please..i do not know why..pleae let me is there any error on my code..please...it's urgent to me..thanks in advance..
Hi Guys,
I have parent and child and when i click on new(child related list button)it goes to the one vf page along with parent id. based on that parent id i am displaying last record from child(only one record) then if i click on save i need to create new record.This procces is going good but when i click on Save button i need to redirect to the parent record view page.(Some times it going very nice but in some times it's not redirecting to the parent record view page )but insert done..please help me ..Thanks in advance..
This is VF Page
<!--
Name:SBWEBVersionButton
Created By : VamsiKrishna
Description: Creating the TUR(Tissues Utilization Record) based on the Tissue.
Modifications:Mobility
-->
<apex:page standardController="Tissue__c" extensions="SBWEBVersioningCLS" sidebar="false" docType="html-5.0">
  <head>
    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
    <script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
  <apex:stylesheet value="{!URLFOR($Resource.SLDS0110, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
  <!--TURVersion CSS Resource--->
              <apex:stylesheet value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/TURVersion.css')}" />
              <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/calendar/calendar_blue.css')}" />
               <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/CBCSS/jquery.mobile.datepicker.css')}" />
                <apex:stylesheet value="{!URLFOR($Resource.CBCSS,'CBCSS/CBCSS/jquery.mobile.datepicker.theme.css')}" />
              <apex:stylesheet value="http://code.jquery.com/mobile/git/jquery.mobile-git.css" /> 
            <!--Jquery Resource CDN-->
              <apex:includeScript value="//code.jquery.com/jquery-1.11.3.min.js"  />
                <apex:includeScript value="http://code.jquery.com/mobile/git/jquery.mobile-git.js"  />
                <apex:includeScript value="//code.jquery.com/jquery-migrate-1.2.1.min.js"  />
                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
               <!--Jquery Resource CDN End-->
              <apex:includeScript value="{!URLFOR($Resource.CBCSS,'CBCSS/calendar/calendar.js')}"/>
              <apex:includeScript value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/TURversionJs.js')}"/>
                  <apex:includeScript value="{!URLFOR($Resource.CBCSS, 'CBCSS/CBCSS/datepicker.js')}"/>
              <script src="//code.jquery.com/jquery-1.10.2.js"></script>
              <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
              <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
               <link rel="stylesheet" href="https://jqueryui.com/jquery-wp-content/themes/jqueryui.com/style.css"/>
               <link rel="stylesheet"  href="http://code.jquery.com/mobile/git/jquery.mobile-git.css" /> 
               <style>
               #ui-datepicker-div{
               width:300px;
              }
               .overlay {
                    background-color:#000;
                    position: absolute;
                    left: 0;
                    top: 0;
                    width: 100%;
                    height: 100%;
                    opacity:0.3;
            }
               </style>
              <script type="text/javascript">
        $(function(){
              $(function(){
                $("[id$='pdob']").datepicker({ maxDate: 0 , dateFormat: 'mm/dd/yy' }).on('changeDate', function(ev){
                    $('#sDate1').text($('#pdob').data('date'));
                    $('#pdob').datepicker('hide');
                });
               })
            })
             $(function(){
              $(function(){
                $("[id$='producerDate']").datepicker({ maxDate: 0 , dateFormat: 'mm/dd/yy' }).on('changeDate', function(ev){
                    $('#sDate1').text($('#pdob').data('date'));
                    $('#producerDate').datepicker('hide');
                });
               })
            })
            $(function () {
            $("[id$='pfirstname']").keydown(function (e) {
            if (e.shiftKey || e.ctrlKey || e.altKey) {
            e.preventDefault();
                    } else {
                    var key = e.keyCode;
                        if (!((key == 8) || (key == 32) || (key == 46) || (key >= 35 && key <= 40) || (key >= 65 && key <= 90))) {
                    e.preventDefault();
                    }
                }
                });
                });
                
                 $(function () {
            $("[id$='plastname']").keydown(function (e) {
            if (e.shiftKey || e.ctrlKey || e.altKey) {
            e.preventDefault();
                    } else {
                    var key = e.keyCode;
                        if (!((key == 8) || (key == 32) || (key == 46) || (key >= 35 && key <= 40) || (key >= 65 && key <= 90))) {
                    e.preventDefault();
                    }
                }
                });
                });
        function pdobvalidation(){
        var date=$("[id$='pdob']").val();
        var inputDate = new Date(date);
        var finalDate=inputDate.setHours(0,0,0,0);
        var today = new Date();
        var finaltoday=today.setHours(0,0,0,0);
        if(finalDate>finaltoday){
        $("[id$='IMDateErorr']").text("Patient Date of Birth must not be future Date");
                    
        return false;
        }else{
        $("[id$='IMDateErorr']").text("");  
        $("#finalerror").text("");  
        }
        }
         function producerDatevalidation(){
        var date=$("[id$='producerDate']").val();
        var inputDate = new Date(date);
        var finalDate=inputDate.setHours(0,0,0,0);
        var today = new Date();
        var finaltoday=today.setHours(0,0,0,0);
        if(finalDate>finaltoday){
        $("[id$='IMDateErorr2']").text("Procedure Date must not be future Date");            
        return false;
        }else{
        $("[id$='IMDateErorr2']").text("");
        $("#finalerror").text("");    
        }
        }
           
          function savingTUR(){
        
        var surgenname= $("[id$='contactnamenew']").val();
        var contactid=$("[id$='contactidnew']").val();
        if(surgenname==''){
         var surgenVal='';
        $("[id$='contactidnew']").val(surgenVal);
        }else if(surgenname && contactid==''){
        $("#contactiderorr").text("Please Select Proper Surgen Name");
        return false;
        }
        var error1=$("#IMDateErorr").text();
        var error2=$("#IMDateErorr2").text();
        var error3=$("#contactiderorr").text();
       if(error1.length==0 && error2.length==0 && error3.length==0){
         $("#finalerror").text("");
        $(".overlay").show();
        savingTURDetail();
        }else{
        $("#finalerror").text("Please check the Errors");
        return false;
         }
       }
           
        </script>
          <script> 
        function goBacktoParent() { 
            Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
        }
    </script>

  </head>
<body>

  <div class="slds">
  <apex:form >
  <apex:actionFunction action="{!CreateTUR}" name="savingTURDetail"  oncomplete="goBacktoParent();" status="sts" immediate="true"/>
    <div class="maindiv">
         <div class="divclass">
             <span class="spanone"><label><b>Tissue Name</b></label></span>
              <span class="spantwo"><apex:outputField value="{!tis.name}"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Surgeon Name</b></label></span>
              <span class="spantwo">
              <apex:inputText html-autocomplete="off"  id="contactnamenew" value="{!contactname}" onkeyup="gensurgenname.call($(this));" styleClass="slds-input" style="max-width:300px" />
               <div id="contactiderorr" style="color:red"></div>
               <div class="drpdwnlist"></div>
          </span>
         </div>
       <div class="divclass">
              <span class="spanone"><label><b>Patient First Name</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Patient_First_Name}" id="pfirstname" styleClass="slds-input" style="max-width:300px" />
             </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Patient Last Name</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Patient_Last_Name}" id="plastname" styleClass="slds-input" style="max-width:300px"/>
              </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Patient DOB</b></label></span>
              <span class="spantwo">
            <apex:inputText id="pdob" size="10" styleClass="slds-input"  value="{!PatientDOB}" style="max-width:300px" onkeyup="return pdobvalidation();"/>
            
            <div id="IMDateErorr" style="color:red"></div>
            </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Gender</b></label></span>
              <span class="spantwo">
              <apex:selectList id="gender" value="{!Genders}"  size="1" styleClass="slds-input" style="max-width:300px">
                <apex:selectOptions value="{!gender}" />
               </apex:selectList>
              </span>
         </div>
         <br/>
         <div class="divclass">
             <span class="spanone"> <label><b>Procedure Type</b></label></span>
              <span class="spantwo">
              <apex:selectList id="procedureType" value="{!Procedure_Type}"  size="1" styleClass="slds-input" style="max-width:300px">
               <apex:selectOptions value="{!ProducerType}"/>
               </apex:selectList></span>
         </div>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Type Comments</b></label></span>
              <span class="spantwo"><apex:inputTextarea value="{!Procedure_Type_Comments}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Date</b></label></span> 
              <span class="spantwo"><apex:inputtext style="max-width:300px" styleClass="slds-input" size="10" id="producerDate"  value="{!Procedure_Date}" onkeyup="return producerDatevalidation();" />
                  <div id="IMDateErorr2" style="color:red"></div>
              </span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Code(1)</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Procedure_Code_1}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Procedure Code(2)</b></label></span>
              <span class="spantwo"><apex:inputtext value="{!Procedure_Code_2}" styleClass="slds-input" style="max-width:300px"/></span>
         </div> 
         <br/>
         <div class="divclass">
              <span class="spanone"><label><b>Comments</b></label></span>
              <span class="spantwo"><apex:inputTextarea value="{!Comments}" styleClass="slds-input" style="max-width:300px"/></span>
         </div>
         <div class="divclass">
               <span class="spanone"><label><b>Pending</b></label></span>
              <span class="spantwo">
              <apex:selectList id="pending" size="1" value="{!Pendings}" styleClass="slds-input" style="max-width:300px">
                  <apex:selectOptions value="{!pendingNEw}"/>
              </apex:selectList></span>
              
         </div>
         <div class="divclass">
               <span class="spanone"><label><b>Source</b></label></span>
              <span class="spantwo">
              <apex:selectList value="{!Sources}" size="1" styleClass="slds-input" style="max-width:300px">
                  <apex:selectOptions value="{!Source}"/>
              </apex:selectList>
              </span>
         </div>    
         <apex:inputText value="{!contactid}"  styleClass="dummy" style="display:none" id="contactidnew" />
         <div id="finalerror" style="color:red"></div>
         <div class="divclass">
              <apex:commandButton value="Save"  onclick="return  savingTUR();"  styleClass="btnclck">
              </apex:commandbutton>
             <div> <apex:pagemessages /></div>
         </div>
        </div>
  </apex:form>
  </div>
  <div class="overlay" style="display:none">
     <center><apex:image url="{!$Resource.Saving_Icon}" height="50" width="50" style="top:45%; left:45%;position: absolute;"  /></center>
    </div>
  </body>
   
</apex:page>
 
/*
Created By : VamsiKrishna
Description: This is related to the TUR(Tissue Utilization Record) Versioning.This will Run when u click on Version  
Custom Buttion and It show the editable VF page if that tissue have the active TUR and now if u edit that TUR it create the new TUR and existing one is in in-active.
otherwise it show one new form to Create the new tur Related to that tissue.
*/
public without sharing class SBWEBVersioningCLS
{
   public string contactname{get;set;}
    public id contactid{get;set;}
    public string Patient_Last_Name{get;set;}
    public string Patient_First_Name{get;set;}
    public string PatientDOB{get;set;}
    public string Pending{get;set;}
    public string Pendings{get;set;}
    public string Procedure_Code_1{get;set;}
    public string Procedure_Code_2{get;set;}
    public string Procedure_Date{get;set;}
    public string Procedure_Type{get;set;}
    public string Genders{get;set;}
    public string Procedure_Type_Comments{get;set;}
    public string Comments{get;set;}
    public string Sources{get;set;}
    public tissue__c tis{get;set;}
    public tissue__c oldtisdetails{get;set;}
    public list<TUR__c> tur{get;set;}
    public Boolean isMobile{get;set;}
    public id turid;
                public SBWEBVersioningCLS(ApexPages.StandardController controller) {
                    this.oldtisdetails=(tissue__c )controller.getRecord();
                    //Here we are fetching the Active TUR detials
                       tur=new list<TUR__c>();
                       tis=new tissue__c();
                        try{
                        tis=[SELECT id,name from Tissue__c WHERE id=:oldtisdetails.id];
                            tur=[SELECT id,Tissue__c,Surgeon_Name__r.name,Surgeon_Name__r.id,Source__c,Gender__c,Active__c,Surgeon_Name__c,Patient_First_Name__c,Patient_Last_Name__c,Procedure_Code_1__c,
                                 Procedure_Code_2__c,Procedure_Date__c,Procedure_Type__c,Procedure_Type_Comments__c,PatientDOB__c,Pending__c,
                                 Comments__c FROM TUR__c WHERE Active__c=true AND tissue__c=:oldtisdetails.id];
                           }catch(exception e){}
                           if(!tur.isEmpty()){
                               for(TUR__c tr:tur){
                              Sources=tr.Source__c;
                              Comments=tr.Comments__c ;
                              Procedure_Type_Comments=tr.Procedure_Type_Comments__c;
                              Genders=tr.Gender__c;
                              Procedure_Type=tr.Procedure_Type__c;
                              //Procedure_Date=string.valueof(tr.Procedure_Date__c);
                              if(tr.Procedure_Date__c!=NULL){
                              String strProDate=string.valueof(tr.Procedure_Date__c);
                              String[] arrProDate = strProDate.split('-');
                             Procedure_Date=arrProDate[1]+'/'+arrProDate[2]+'/'+arrProDate[0];
                              }
                              Procedure_Code_2=tr.Procedure_Code_2__c;
                              Procedure_Code_1=tr.Procedure_Code_1__c;
                              Pendings=tr.Pending__c;
                              if(tr.PatientDOB__c!=NULL){
                               String strPDOB=string.valueof(tr.PatientDOB__c);
                              String[] arrpDOB = strPDOB.split('-');
                             PatientDOB=arrpDOB[1]+'/'+arrpDOB[2]+'/'+arrpDOB[0]; 
                            } 
                             Patient_First_Name=tr.Patient_First_Name__c;
                             Patient_Last_Name=tr.Patient_Last_Name__c;
                             //PatientDOB=tr.PatientDOB__c;
                             contactname=tr.Surgeon_Name__r.name;
                             contactid=tr.Surgeon_Name__c;
                          }
                      }
                      if(String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) || String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin'))){
                           isMobile = true;
                      }else{isMobile = false;}
            }
            public List<SelectOption> getProducerType(){
                   List<SelectOption> pTypes= new List<SelectOption>();
                   Schema.DescribeFieldResult ptypeResult =TUR__c.Procedure_Type__c.getDescribe();
                   List<Schema.PicklistEntry> ptypeList = ptypeResult.getPicklistValues();
                   for( Schema.PicklistEntry Tpt : ptypeList)
                   {
                      pTypes.add(new SelectOption(Tpt.getLabel(), Tpt.getValue()));
                   }       
                   return pTypes;
               }
             public list<SelectOption> getgender(){
             List<SelectOption> gender= new List<SelectOption>();
             Schema.DescribeFieldResult genderResult =TUR__c.Gender__c.getDescribe();
                   List<Schema.PicklistEntry> genderList = genderResult .getPicklistValues();
                   for( Schema.PicklistEntry gen: genderList )
                   {
                      gender.add(new SelectOption(gen.getLabel(), gen.getValue()));
                   }       
                   return gender;
             }
             public list<SelectOption> getpendingNEw(){
             List<SelectOption> pendingss= new List<SelectOption>();
             Schema.DescribeFieldResult PendResult =TUR__c.Pending__c.getDescribe();
                   List<Schema.PicklistEntry> pendList = PendResult.getPicklistValues();
                   for( Schema.PicklistEntry pen:pendList )
                   {
                      pendingss.add(new SelectOption(pen.getLabel(),pen.getValue()));
                   }       
                   return pendingss;
             }
             public list<SelectOption> getSource(){
             List<SelectOption> Source= new List<SelectOption>();
             Schema.DescribeFieldResult SourceResult =TUR__c.Source__c.getDescribe();
                   List<Schema.PicklistEntry> SourceList = SourceResult.getPicklistValues();
                   for( Schema.PicklistEntry sou: SourceList )
                   {
                      Source.add(new SelectOption(sou.getLabel(), sou.getValue()));
                   }       
                   return Source;
             }
            @RemoteAction 
      Public static string surgenName(string con){
      
               string qstring = con+'%';
               string resultstring='';
               list<contact> srchconlist =new list<contact>();
                srchconlist = [select id,name from contact where name like:qstring];
                    if(!srchconlist.isEmpty()){
                       for(contact co : srchconlist){
                              resultstring+=co.name+'%'+co.id+'#';
                               }
                           }else{
                           resultstring='No Records';
                           }
                       return resultstring;
                     }
//This is used to save the records related to the TUR..
        public pagereference CreateTUR(){
        pagereference parentpage=new pagereference('/'+oldtisdetails.id);//It redirect the page to the Parent Record Details Page based on the Tissue id
          
           system.debug('oldtisdetails@@@'+oldtisdetails);
           if(String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) || String.isNotBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin'))){
             isMobile = true;
            }else{isMobile = false;}
           TUR__c newtur=new TUR__c();
           newtur.Tissue__c=oldtisdetails.id;
           newtur.Patient_Last_Name__c=Patient_Last_Name;
           system.debug('contactid@@'+contactid);
           newtur.Surgeon_Name__c=contactid;
           newtur.Patient_First_Name__c=Patient_First_Name;
           if(PatientDOB!=''){
           String  dbdt=PatientDOB;
           newtur.PatientDOB__c=date.parse(PatientDOB);
           }
           newtur.Pending__c=Pendings;
           newtur.Procedure_Code_1__c=Procedure_Code_1;
           newtur.Procedure_Code_2__c=Procedure_Code_2;
           if(Procedure_Date!=''){
           newtur.Procedure_Date__c=date.parse(Procedure_Date);
           }
           newtur.Procedure_Type__c=Procedure_Type;
           newtur.Gender__c=Genders;
           newtur.Procedure_Type_Comments__c=Procedure_Type_Comments;
           newtur.Comments__c =Comments ;
           newtur.Source__c=Sources;
           try{
           insert newtur;//Inserting the TUR
            if(!tur.isEmpty()){
               //tur.id=turid;
                
               tur[0].Active__c=false;//In-active the Old TUR
               update tur;//Updating the Old TUR.
                }
                 if(isMobile==false){
                 parentpage.setRedirect(true);
                    return parentpage; //It redirect the page to the Parent Record Details Page
                }else{
                    return null;// It is for Mobile redirection
                 }  
                }catch(DMLException de){
                     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Error'+de));
                     return null;
                }
                  
  }
}
Please check and give me some suggestions..i do nto know why it is redirecting some times and why it's not redirecting at some times..please..
Hi Guys,
<apex:input type="date" value={!somevalue}/>

in the above situation how can i disable the future dates in that date puicker..please help me....thanks in advance..
Hi Guys,
I am using Wrapper class varialbe in vf.It showing error :Read inoy Property..
 My wrapper class varibale declaration is 

public Date FromDateCriteria;
      Public  void setFromDateCriteria(Date FromDateCriteria) {
      this.FromDateCriteria = FromDateCriteria;
     }
   public string getFromDateCriteria() {
      if(FromDateCriteria==NULL){
       return NULL;
      }
    return FromDateCriteria.format();
    }

Please give me some solutions..
Hi Guys,
I have date field in Vf Like : <apex:inputtext id="implatedDate" size="10" value="{!tissue.implanteddate}"/>
and  this "implanteddate" from Wrapper class. Also i have one command button "Next"
By clicking on Next button my page is refreshing and by that time date format is changing it to different format and showing the below error:
" Value 'Wed Dec 16 00:00:00 GMT 2015' cannot be converted from Text to com.force.swag.soap.DateOnlyWrapper "

​Please update me with your solution.
 
Hi Guys,
I have date field in Vf Like : <apex:inputtext id="implatedDate" size="10" value="{!tissue.implanteddate}"/>
and  this "implanteddate" from Wrapper class. Also i have one command button "Next"
By clicking on Next button my page is refreshing and by that time date format is changing it to different format and showing the below error:
" Value 'Wed Dec 16 00:00:00 GMT 2015' cannot be converted from Text to com.force.swag.soap.DateOnlyWrapper "

Please update me with your solution.

 
var lastvalue=1;
var pricecheckid='#pricecheckselected#*'+lastvalue;
<apex:form>
<apex:checkbox value="true" id="pricecheckselected#*1" />

<apex:checkbox value="true" id="reordeselected#*1" />

</apex:form>


reordeselected#*1(this is also dynamic value)
 pricecheckselected#*1(this is dynamic value).now when i click on another check reordeselected#*1 i need disable  pricecheckselected#*1 this check box..please help me
now i want pricecheckid variable and some checkbox have same id like pricecheckid variable.now i want use this variable and need to disable that check box and need to uncheck that checkbox by using jquery..please help me..or give me some suggestions on it..
thanks in advance..

Regard's
Vamsi
I want to make following image in Salesforce. Is it possible in Salesforce? 

User-added image

Please help me. if it is possible. I want some help. It's urgent
Hi Guys,
<apex:input type="date" value={!somevalue}/>

in the above situation how can i disable the future dates in that date puicker..please help me....thanks in advance..
Hi Guys,
I am using Wrapper class varialbe in vf.It showing error :Read inoy Property..
 My wrapper class varibale declaration is 

public Date FromDateCriteria;
      Public  void setFromDateCriteria(Date FromDateCriteria) {
      this.FromDateCriteria = FromDateCriteria;
     }
   public string getFromDateCriteria() {
      if(FromDateCriteria==NULL){
       return NULL;
      }
    return FromDateCriteria.format();
    }

Please give me some solutions..
Hi Guys,
I have date field in Vf Like : <apex:inputtext id="implatedDate" size="10" value="{!tissue.implanteddate}"/>
and  this "implanteddate" from Wrapper class. Also i have one command button "Next"
By clicking on Next button my page is refreshing and by that time date format is changing it to different format and showing the below error:
" Value 'Wed Dec 16 00:00:00 GMT 2015' cannot be converted from Text to com.force.swag.soap.DateOnlyWrapper "

​Please update me with your solution.
 

Hi Can anyone help me to resolve this. I am getting this error in VF controller. I am creating a custom picklist in VF controller wrapper class and  getting this
Error in debug while second run : System.TypeException: Invalid conversion from runtime type String to List<System.SelectOption>

sample code :
public class controller{
public class Wrapper
    {
      public boolean isCheck{get;set}
      public List<SelectOption> Picklist{get;set;}
      public String name{get;set;}
        }    

public List<wrapper> getwrapperlist()
    {
   
    return wrapperlist;
    } 

   public void setwrapperlist()
   {
    this.wrapperlist=wrapperlist;
   }

  public void method1()
{
 Wrapper w=new Wrapper();
w.addPicker=new List<selectoption>();
for(list<object> s:olist){
w.addPicker.add(new SelectOption (s.fname,s.fname));
}
wrapperlist.add(w);

}
}

 

Apologies if this has already been answered but I have spent more than an hour looking and still cannot find an answer to my problem:

 

I am using a datepicker on an apex:inputtext field, to establish a from and to date range. It works fine, but when the screen is refreshed the value in the date changes from:

 

   D/MM/YYY format (what I am after), to something like this: 

   Mon Jul 15 00:00:00 GMT 2013

 

Therefore, next time I attempt to perform an action, I get an error message saying:

 

   Error:   Value 'Mon Jul 15 00:00:00 GMT 2013' cannot be converted from Text to Date
 
How can I prevent the date from being incorrectly reformatted?
 
Here is an exceprt from my VF code:
 

<apex:pageBlockSectionItem >
   <apex:outputLabel value="From Due Date" for="fromDate"/>
   <apex:inputText value="{!fromDateCriteria}" size="10" onfocus="DatePicker.pickDate(false, this, false);" id="fromDate" />
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >

 

<apex:pageBlockSectionItem >
   <apex:outputLabel value="To Due Date" for="toDate"/>
   <apex:inputText value="{!toDateCriteria}" size="10" onfocus="DatePicker.pickDate(false, this, false);" id="toDate" />
</apex:pageBlockSectionItem>

 

 

My controller simply uses auto getters and setters:

 

public date FromDateCriteria {get;set;}
public date ToDateCriteria {get;set;}

 

Everything work fine, except for the reformat when the UI is redisplayed.

 

Thanks in advance...