• prateek khanna 24
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies
Let,s say I have amount Its value is 2000 , ANd when I go to inline edit and I add +10% it should increase the value by 10% or -10% , then it should decrease the value by 10% in Lightning data table.
Milestone and Opportunity Object is there , On Opportunity you have custom field called total Amount, if opportunity is inserted with 10000 as total amount, automatically 10 milesstone should be created.
if the amount is 15000, 15 milesstone should be created and so on.
Vf Code- <apex:page standardController="Feedbacks__c" docType="html-5.0" extensions="FeedbackHelper"> <apex:pageBlock > <apex:pageBlockSection > <apex:form > <style> a { color: #337ab7; } p { margin-top: 1rem; } a:hover { color:#23527c; } a:visited { color: #8d75a3; } body { line-height: 1.5; font-family: sans-serif; word-wrap: break-word; overflow-wrap: break-word; color:black; margin:2em; } h1 { text-decoration: underline red; text-decoration-thickness: 3px; text-underline-offset: 6px; font-size: 220%; font-weight: bold; } h2 { font-weight: bold; color: #005A9C; font-size: 140%; text-transform: uppercase; } red { color: red; } #controls { display: flex; margin-top: 2rem; max-width: 28em; } button { flex-grow: 1; height: 3.5rem; min-width: 2rem; border: none; border-radius: 0.15rem; background: #ed341d; margin-left: 2px; box-shadow: inset 0 -0.15rem 0 rgba(0, 0, 0, 0.2); cursor: pointer; display: flex; justify-content: center; align-items: center; color:#ffffff; font-weight: bold; font-size: 1.5rem; } button:hover, button:focus { outline: none; background: #c72d1c; } button::-moz-focus-inner { border: 0; } button:active { box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2); line-height: 3rem; } button:disabled { pointer-events: none; background: lightgray; } button:first-child { margin-left: 0; } audio { display: block; width: 100%; margin-top: 0.2rem; } li { list-style: none; margin-bottom: 1rem; } #formats { margin-top: 0.5rem; font-size: 80%; } #recordingsList{ max-width: 28em; } </style> <script> URL = window.URL || window.webkitURL; var gumStream; //stream from getUserMedia() var rec; //Recorder.js object var input; //MediaStreamAudioSourceNode we'll be recording // shim for AudioContext when it's not avb. var AudioContext = window.AudioContext || window.webkitAudioContext; var audioContext //audio context to help us record var recordButton = document.getElementById("recordButton"); var stopButton = document.getElementById("stopButton"); var pauseButton = document.getElementById("pauseButton"); /* //add events to those 2 buttons recordButton.addEventListener("click", startRecording); stopButton.addEventListener("click", stopRecording); pauseButton.addEventListener("click", pauseRecording); */ function startRecording() { console.log("recordButton clicked"); /* Simple constraints object, for more advanced audio features see https://addpipe.com/blog/audio-constraints-getusermedia/ */ var constraints = { audio: true, video:false } /* Disable the record button until we get a success or fail from getUserMedia() */ /* recordButton.disabled = true; stopButton.disabled = false; pauseButton.disabled = false */ /* We're using the standard promise based getUserMedia() https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia */ navigator.mediaDevices.getUserMedia(constraints).then(function(stream) { console.log("getUserMedia() success, stream created, initializing Recorder.js ..."); /* create an audio context after getUserMedia is called sampleRate might change after getUserMedia is called, like it does on macOS when recording through AirPods the sampleRate defaults to the one set in your OS for your playback device */ audioContext = new AudioContext(); //update the format document.getElementById("formats").innerHTML="Format: 1 channel pcm @ "+audioContext.sampleRate/1000+"kHz" gumStream = stream; input = audioContext.createMediaStreamSource(stream); /* Create the Recorder object and configure to record mono sound (1 channel) Recording 2 channels will double the file size */ rec = new Recorder(input,{numChannels:1}) //start the recording process rec.record() console.log("Recording started"); }).catch(function(err) { //enable the record button if getUserMedia() fails recordButton.disabled = false; stopButton.disabled = true; pauseButton.disabled = true }); } function pauseRecording(){ console.log("pauseButton clicked rec.recording=",rec.recording ); if (rec.recording){ //pause rec.stop(); //pauseButton.innerHTML="Resume"; }else{ //resume rec.record() //pauseButton.innerHTML="Pause"; } } function stopRecording() { console.log("stopButton clicked"); //disable the stop button, enable the record too allow for new recordings /* stopButton.disabled = true; recordButton.disabled = false; pauseButton.disabled = true; */ //reset button just in case the recording is stopped while paused // pauseButton.innerHTML="Pause"; //tell the recorder to stop the recording rec.stop(); //stop microphone access gumStream.getAudioTracks()[0].stop(); //create the wav blob and pass it on to createDownloadLink rec.exportWAV(createDownloadLink); savingAudioFile(rec, rec.Name); } function createDownloadLink(blob) { console.log('===Blob====',blob); var recordId = '{!$CurrentPage.Parameters.Id}'; console.log('===RecordId==='+recordId); FeedbackHelper.uploadFile(recordId,blob,function(result,event){ if(event.status){ console.log(result); } }); var url = URL.createObjectURL(blob); var au = document.createElement('audio'); var li = document.createElement('li'); var link = document.createElement('a'); //name of .wav file to use during upload and download (without extendion) var filename = new Date().toISOString(); //add controls to the <audio> element au.controls = true; au.src = url; //save to disk link link.href = url; link.download = filename+".wav"; //download forces the browser to donwload the file using the filename //link.innerHTML = "Save to disk"; //add the new audio element to li li.appendChild(au); //add the filename to the li li.appendChild(document.createTextNode(filename+".wav ")) //add the save to disk link to li li.appendChild(link); //upload link var upload = document.createElement('a'); upload.href="#"; // upload.innerHTML = "Upload"; upload.addEventListener("click", function(event){ var xhr=new XMLHttpRequest(); xhr.onload=function(e) { if(this.readyState === 4) { console.log("Server returned: ",e.target.responseText); } }; var fd=new FormData(); fd.append("audio_data",blob, filename); xhr.open("POST","upload.php",true); xhr.send(fd); }) li.appendChild(document.createTextNode (" "))//add a space in between li.appendChild(upload)//add the upload link to li //add the li element to the ol recordingsList.appendChild(li); } </script> <html> <head> <title>Simple Recorder.js demo with record, stop and pause - addpipe.com</title> <!-- Latest compiled and minified Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <div id="controls"> <input id="recordButton" type="button" value="Recorder" onclick="startRecording();"/> <input id="pauseButton" type="button" value="Pause" onclick="pauseRecording();"/> <input id="stopButton" type="button" value="Stop" onclick="stopRecording();"/> </div> <div id="formats">Format: start recording to see sample rate</div> <p><strong>Recordings:</strong></p> <ol id="recordingsList"></ol> <!-- inserting these scripts at the end to be able to use all the elements in the DOM --> <script src="https://cdn.rawgit.com/mattdiamond/Recorderjs/08e7abd9/dist/recorder.js"></script> <script src="js/app.js"></script> </body> </html> </apex:form> </apex:pageBlockSection> </apex:pageBlock> </apex:page>

apex- global class FeedbackHelper {
    public FeedbackHelper(ApexPages.StandardController controller){        
    }
    @remoteaction
    global static void uploadFile(string recordId,string rec){
        system.debug('====='+rec);
        Attachment myattach = new Attachment(ParentId = recordId, Name = 'test.wav', Body = Blob.valueOf('' + rec), ContentType = 'audio/wav');
        insert myattach;
    }
    public PageReference savingAudioFile(Object rec, String recName){
        Feedbacks__c feed = new Feedbacks__c();
        insert feed;
        Attachment myattach = new Attachment(ParentId = feed.id, Name = recName+'.wav', Body = Blob.valueOf('' + rec), ContentType = 'audio/wav');
        insert myattach;
        system.debug('Attachmetn :: ' + myattach.name);
        return null;
    }
    public pageReference file(string fileLink){
        PageReference pr = new PageReference(fileLink);
        pr.setRedirect(true);
        return pr;
    }
}
Visualforce Code-

<apex:page standardController="Feedbacks__c" docType="html-5.0">
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:form >
                <style>
                    a {
  color: #337ab7;   
}   
p {
  margin-top: 1rem;
}
a:hover {
  color:#23527c;
}
a:visited {
  color: #8d75a3;
}

body {
    line-height: 1.5;
    font-family: sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color:black;
    margin:2em;
}

h1 {
    text-decoration: underline red;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
    font-size: 220%;
    font-weight: bold;
}

h2 {
    font-weight: bold;
    color: #005A9C;
    font-size: 140%;
    text-transform: uppercase;
}

red {
    color: red;
}

#controls {
  display: flex;
  margin-top: 2rem;
  max-width: 28em;


button {
  flex-grow: 1;
  height: 3.5rem;
  min-width: 2rem;
  border: none;
  border-radius: 0.15rem;
  background: #ed341d;
  margin-left: 2px;
  box-shadow: inset 0 -0.15rem 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  color:#ffffff;
  font-weight: bold;
  font-size: 1.5rem;
}

button:hover, button:focus {
  outline: none;
  background: #c72d1c;
}

button::-moz-focus-inner {
  border: 0;
}

button:active {
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2);
  line-height: 3rem;
}

button:disabled {
  pointer-events: none;
  background: lightgray;
}
button:first-child {
  margin-left: 0;
}

audio {
  display: block;
  width: 100%;
  margin-top: 0.2rem;
}

li {
  list-style: none;
  margin-bottom: 1rem;
}

#formats {
  margin-top: 0.5rem;
  font-size: 80%;
}

#recordingsList{
    max-width: 28em;
}
                </style>
                <script>
                  URL = window.URL || window.webkitURL;

var gumStream;            //stream from getUserMedia()
var rec;              //Recorder.js object
var input;              //MediaStreamAudioSourceNode we'll be recording

// shim for AudioContext when it's not avb. 
var AudioContext = window.AudioContext || window.webkitAudioContext;
var audioContext //audio context to help us record

var recordButton = document.getElementById("recordButton");
var stopButton = document.getElementById("stopButton");
var pauseButton = document.getElementById("pauseButton");
/*
//add events to those 2 buttons
recordButton.addEventListener("click", startRecording);
stopButton.addEventListener("click", stopRecording);
pauseButton.addEventListener("click", pauseRecording);
*/
function startRecording() {
  console.log("recordButton clicked");

  /*
    Simple constraints object, for more advanced audio features see
    https://addpipe.com/blog/audio-constraints-getusermedia/
  */
    var constraints = { audio: true, video:false }

  /*
      Disable the record button until we get a success or fail from getUserMedia() 
  */
  /*
  recordButton.disabled = true;
  stopButton.disabled = false;
  pauseButton.disabled = false
  */
  /*
      We're using the standard promise based getUserMedia() 
      https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
  */

  navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
    console.log("getUserMedia() success, stream created, initializing Recorder.js ...");

    /*
      create an audio context after getUserMedia is called
      sampleRate might change after getUserMedia is called, like it does on macOS when recording through AirPods
      the sampleRate defaults to the one set in your OS for your playback device
    */
    audioContext = new AudioContext();

    //update the format 
    document.getElementById("formats").innerHTML="Format: 1 channel pcm @ "+audioContext.sampleRate/1000+"kHz"

    gumStream = stream;
    
    input = audioContext.createMediaStreamSource(stream);

    /* 
      Create the Recorder object and configure to record mono sound (1 channel)
      Recording 2 channels  will double the file size
    */
    rec = new Recorder(input,{numChannels:1})

    //start the recording process
    rec.record()

    console.log("Recording started");

  }).catch(function(err) {
      //enable the record button if getUserMedia() fails
      recordButton.disabled = false;
      stopButton.disabled = true;
      pauseButton.disabled = true
  });
}

function pauseRecording(){
  console.log("pauseButton clicked rec.recording=",rec.recording );
  if (rec.recording){
    //pause
    rec.stop();
    //pauseButton.innerHTML="Resume";
  }else{
    //resume
    rec.record()
    //pauseButton.innerHTML="Pause";

  }
}

function stopRecording() {
  console.log("stopButton clicked");

  //disable the stop button, enable the record too allow for new recordings
  /*Meenamma
  stopButton.disabled = true;
  recordButton.disabled = false;
  pauseButton.disabled = true;
  */
  //reset button just in case the recording is stopped while paused
 // pauseButton.innerHTML="Pause";
  
  //tell the recorder to stop the recording
  rec.stop();

  //stop microphone access
  gumStream.getAudioTracks()[0].stop();

  //create the wav blob and pass it on to createDownloadLink
  rec.exportWAV(createDownloadLink);
}

function createDownloadLink(blob) {
  
  var url = URL.createObjectURL(blob);
  var au = document.createElement('audio');
  var li = document.createElement('li');
  var link = document.createElement('a');

  //name of .wav file to use during upload and download (without extendion)
  var filename = new Date().toISOString();

  //add controls to the <audio> element
  au.controls = true;
  au.src = url;

  //save to disk link
  link.href = url;
  link.download = filename+".wav"; //download forces the browser to donwload the file using the  filename
  link.innerHTML = "Save to disk";

  //add the new audio element to li
  li.appendChild(au);
  
  //add the filename to the li
  li.appendChild(document.createTextNode(filename+".wav "))

  //add the save to disk link to li
  li.appendChild(link);
  
  //upload link
  var upload = document.createElement('a');
  upload.href="#";
  upload.innerHTML = "Upload";
  upload.addEventListener("click", function(event){
      var xhr=new XMLHttpRequest();
      xhr.onload=function(e) {
          if(this.readyState === 4) {
              console.log("Server returned: ",e.target.responseText);
          }
      };
      var fd=new FormData();
      fd.append("audio_data",blob, filename);
      xhr.open("POST","upload.php",true);
      xhr.send(fd);
  })
  li.appendChild(document.createTextNode (" "))//add a space in between
  li.appendChild(upload)//add the upload link to li

  //add the li element to the ol
  recordingsList.appendChild(li);
}
                </script>
                <html>
  <head>
    <title>Simple Recorder.js demo with record, stop and pause - addpipe.com</title>
    <!-- Latest compiled and minified Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/>
    <link rel="stylesheet" type="text/css" href="style.css"/>
  </head>
  <body>
    <div id="controls">
     <input id="recordButton" type="button" value="Recorder" onclick="startRecording();"/>
     <input id="pauseButton" type="button" value="Pause" onclick="pauseRecording();"/>
     <input id="stopButton" type="button" value="Stop" onclick="stopRecording();"/>
    </div>
    <div id="formats">Format: start recording to see sample rate</div>
    <p><strong>Recordings:</strong></p>
    <ol id="recordingsList"></ol>
    <!-- inserting these scripts at the end to be able to use all the elements in the DOM -->
    <script src="https://cdn.rawgit.com/mattdiamond/Recorderjs/08e7abd9/dist/recorder.js"></script>
    <script src="js/app.js"></script>
  </body>
</html>
I have one query-
 Component-
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="feedbackCls">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="feedbackLst" type="object"/>
    <div>
        <table>
            <thead>
                <th>Opportunity Name</th>
                <th>Manager</th>
                <th>Comments</th>
                <th>Action</th> 
            </thead>
            <tbody>
                <aura:iteration items="{!v.feedbackLst}" var="lst">
                    <tr>
                        <td>{!lst.Opportunity__r.Name}</td>
                        <td>{!lst.Opportunity__r.ownerId}</td>
                        <td>{!lst.Feedback__c}</td> 
                        <td><input id="{!lst.Id}" type="button" label="approve" value="Approve" onclick="{!c.doApprove}"/><input type="button" value="Reject"/></td>
                    </tr> 
                </aura:iteration>
            </tbody>
        </table>
    </div>
</aura:component>

Controller - 

({
    doInit : function(component, event, helper) {
        console.log('===Test==');
        var action = component.get("c.fetchRecords");
        console.log('===action==='+action);
        action.setCallback(this, function(response) {
            console.log('===response==='+response.getReturnValue());
            component.set("v.feedbackLst",response.getReturnValue());
            var state = response.getState();
            if (state === "SUCCESS") {
                console.log("From server: " + response.getReturnValue());
            }
        }); 
        $A.enqueueAction(action);
    },
   doApprove:function(component,event,helper){
        var a = event.target.Id;
        console.log(a);
  },
})

Apex class-
 
public class feedbackCls {
    @auraEUser-added imagenabled
    public static list<Feedbacks__c> fetchRecords(){
        list<Feedbacks__c> lst = new list<Feedbacks__c>();
        lst = [select id,name,Feedback__c,Opportunity__r.Name,Opportunity__r.ownerId from Feedbacks__c];
        return lst;
    }
Milestone and Opportunity Object is there , On Opportunity you have custom field called total Amount, if opportunity is inserted with 10000 as total amount, automatically 10 milesstone should be created.
if the amount is 15000, 15 milesstone should be created and so on.
Hi Team,
I have a .CSV file which contains object names and field names.When I upload this file in salesforce org, autometically create that objects and fields. How can we achieve this requirement.
              Thanks in Advance...
Thanks,
Venkat.

Hi,

I am trying to get the list of accounts, under the Hierarchy. (example I am the contact of an account AAA, and I am the parent account for X1, X2, and X3 accounts whose status is Active, Partner Account is TRUE, and Record. Type is CC.)  
 

User u = [SELECT Contact.AccountId FROM User WHERE Id = :UserInfo.getUserId() WITH SECURITY_ENFORCED];
        String accountId = u.Contact.AccountId;
        Set<Id> accIds = new Set<Id>{accountId};
        List<Account> accounts = new List<Account>();
        while(!accIds.isEmpty()){
            List<Account> accList = [Select Id, Name, ParentId, CenterCode__c, (Select Id, Name, ParentId FROM ChildAccounts) FROM Account Where 
            Status__c = 'Active' and
            IsPartner = true and
            RecordType.Name = 'Community Account' AND Id IN :accIds ORDER By Name];
            accIds = new Set<Id>();
            for(Account acc:accList){
                accounts.add(new Account(Id = acc.Id, Name = acc.Name, CenterCode__c = acc.CenterCode__c, ParentId = accountId == acc.Id ? null : acc.ParentId));
                if(!acc.childAccounts.isEmpty())
                    for(Account accChild:acc.childAccounts){
                        accIds.add(accChild.Id);
                    }
            }
        }
        return accounts;

1. I am using the WHILE condition to get into the loop, and this is running number of times.

2. If I am using if condition, the loop is running only one time, but i am not getting the list of accounts on the UI.

Your help would be really appreciated.

Thanks
Ravi.

 

Vf Code- <apex:page standardController="Feedbacks__c" docType="html-5.0" extensions="FeedbackHelper"> <apex:pageBlock > <apex:pageBlockSection > <apex:form > <style> a { color: #337ab7; } p { margin-top: 1rem; } a:hover { color:#23527c; } a:visited { color: #8d75a3; } body { line-height: 1.5; font-family: sans-serif; word-wrap: break-word; overflow-wrap: break-word; color:black; margin:2em; } h1 { text-decoration: underline red; text-decoration-thickness: 3px; text-underline-offset: 6px; font-size: 220%; font-weight: bold; } h2 { font-weight: bold; color: #005A9C; font-size: 140%; text-transform: uppercase; } red { color: red; } #controls { display: flex; margin-top: 2rem; max-width: 28em; } button { flex-grow: 1; height: 3.5rem; min-width: 2rem; border: none; border-radius: 0.15rem; background: #ed341d; margin-left: 2px; box-shadow: inset 0 -0.15rem 0 rgba(0, 0, 0, 0.2); cursor: pointer; display: flex; justify-content: center; align-items: center; color:#ffffff; font-weight: bold; font-size: 1.5rem; } button:hover, button:focus { outline: none; background: #c72d1c; } button::-moz-focus-inner { border: 0; } button:active { box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2); line-height: 3rem; } button:disabled { pointer-events: none; background: lightgray; } button:first-child { margin-left: 0; } audio { display: block; width: 100%; margin-top: 0.2rem; } li { list-style: none; margin-bottom: 1rem; } #formats { margin-top: 0.5rem; font-size: 80%; } #recordingsList{ max-width: 28em; } </style> <script> URL = window.URL || window.webkitURL; var gumStream; //stream from getUserMedia() var rec; //Recorder.js object var input; //MediaStreamAudioSourceNode we'll be recording // shim for AudioContext when it's not avb. var AudioContext = window.AudioContext || window.webkitAudioContext; var audioContext //audio context to help us record var recordButton = document.getElementById("recordButton"); var stopButton = document.getElementById("stopButton"); var pauseButton = document.getElementById("pauseButton"); /* //add events to those 2 buttons recordButton.addEventListener("click", startRecording); stopButton.addEventListener("click", stopRecording); pauseButton.addEventListener("click", pauseRecording); */ function startRecording() { console.log("recordButton clicked"); /* Simple constraints object, for more advanced audio features see https://addpipe.com/blog/audio-constraints-getusermedia/ */ var constraints = { audio: true, video:false } /* Disable the record button until we get a success or fail from getUserMedia() */ /* recordButton.disabled = true; stopButton.disabled = false; pauseButton.disabled = false */ /* We're using the standard promise based getUserMedia() https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia */ navigator.mediaDevices.getUserMedia(constraints).then(function(stream) { console.log("getUserMedia() success, stream created, initializing Recorder.js ..."); /* create an audio context after getUserMedia is called sampleRate might change after getUserMedia is called, like it does on macOS when recording through AirPods the sampleRate defaults to the one set in your OS for your playback device */ audioContext = new AudioContext(); //update the format document.getElementById("formats").innerHTML="Format: 1 channel pcm @ "+audioContext.sampleRate/1000+"kHz" gumStream = stream; input = audioContext.createMediaStreamSource(stream); /* Create the Recorder object and configure to record mono sound (1 channel) Recording 2 channels will double the file size */ rec = new Recorder(input,{numChannels:1}) //start the recording process rec.record() console.log("Recording started"); }).catch(function(err) { //enable the record button if getUserMedia() fails recordButton.disabled = false; stopButton.disabled = true; pauseButton.disabled = true }); } function pauseRecording(){ console.log("pauseButton clicked rec.recording=",rec.recording ); if (rec.recording){ //pause rec.stop(); //pauseButton.innerHTML="Resume"; }else{ //resume rec.record() //pauseButton.innerHTML="Pause"; } } function stopRecording() { console.log("stopButton clicked"); //disable the stop button, enable the record too allow for new recordings /* stopButton.disabled = true; recordButton.disabled = false; pauseButton.disabled = true; */ //reset button just in case the recording is stopped while paused // pauseButton.innerHTML="Pause"; //tell the recorder to stop the recording rec.stop(); //stop microphone access gumStream.getAudioTracks()[0].stop(); //create the wav blob and pass it on to createDownloadLink rec.exportWAV(createDownloadLink); savingAudioFile(rec, rec.Name); } function createDownloadLink(blob) { console.log('===Blob====',blob); var recordId = '{!$CurrentPage.Parameters.Id}'; console.log('===RecordId==='+recordId); FeedbackHelper.uploadFile(recordId,blob,function(result,event){ if(event.status){ console.log(result); } }); var url = URL.createObjectURL(blob); var au = document.createElement('audio'); var li = document.createElement('li'); var link = document.createElement('a'); //name of .wav file to use during upload and download (without extendion) var filename = new Date().toISOString(); //add controls to the <audio> element au.controls = true; au.src = url; //save to disk link link.href = url; link.download = filename+".wav"; //download forces the browser to donwload the file using the filename //link.innerHTML = "Save to disk"; //add the new audio element to li li.appendChild(au); //add the filename to the li li.appendChild(document.createTextNode(filename+".wav ")) //add the save to disk link to li li.appendChild(link); //upload link var upload = document.createElement('a'); upload.href="#"; // upload.innerHTML = "Upload"; upload.addEventListener("click", function(event){ var xhr=new XMLHttpRequest(); xhr.onload=function(e) { if(this.readyState === 4) { console.log("Server returned: ",e.target.responseText); } }; var fd=new FormData(); fd.append("audio_data",blob, filename); xhr.open("POST","upload.php",true); xhr.send(fd); }) li.appendChild(document.createTextNode (" "))//add a space in between li.appendChild(upload)//add the upload link to li //add the li element to the ol recordingsList.appendChild(li); } </script> <html> <head> <title>Simple Recorder.js demo with record, stop and pause - addpipe.com</title> <!-- Latest compiled and minified Bootstrap CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"/> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <div id="controls"> <input id="recordButton" type="button" value="Recorder" onclick="startRecording();"/> <input id="pauseButton" type="button" value="Pause" onclick="pauseRecording();"/> <input id="stopButton" type="button" value="Stop" onclick="stopRecording();"/> </div> <div id="formats">Format: start recording to see sample rate</div> <p><strong>Recordings:</strong></p> <ol id="recordingsList"></ol> <!-- inserting these scripts at the end to be able to use all the elements in the DOM --> <script src="https://cdn.rawgit.com/mattdiamond/Recorderjs/08e7abd9/dist/recorder.js"></script> <script src="js/app.js"></script> </body> </html> </apex:form> </apex:pageBlockSection> </apex:pageBlock> </apex:page>

apex- global class FeedbackHelper {
    public FeedbackHelper(ApexPages.StandardController controller){        
    }
    @remoteaction
    global static void uploadFile(string recordId,string rec){
        system.debug('====='+rec);
        Attachment myattach = new Attachment(ParentId = recordId, Name = 'test.wav', Body = Blob.valueOf('' + rec), ContentType = 'audio/wav');
        insert myattach;
    }
    public PageReference savingAudioFile(Object rec, String recName){
        Feedbacks__c feed = new Feedbacks__c();
        insert feed;
        Attachment myattach = new Attachment(ParentId = feed.id, Name = recName+'.wav', Body = Blob.valueOf('' + rec), ContentType = 'audio/wav');
        insert myattach;
        system.debug('Attachmetn :: ' + myattach.name);
        return null;
    }
    public pageReference file(string fileLink){
        PageReference pr = new PageReference(fileLink);
        pr.setRedirect(true);
        return pr;
    }
}
Didn't have much luck in searching for this, so I figured I'd ask.

I have a spreadsheet I need to integrate to Salesforce for a client which is doing some propriatary calculations to output some leasing values for an opportunity. My initial plan was to simply recreate this logic in Salesforce and have the system auto calculate it and output it to a field on an opportunity, but the leasing company won't unlock the spreadsheet or allow anyone access to their calculations.

Is there any other way to pass values to and from a Spreadsheet? I wasn't finding any obvious answers or apps, which I think is usually because Salesforce aims to replace the spreadsheets. The client and I really want to get rid of the spreadsheet, but since we can't attain these propriatary calculations we're stuck with it for the time being and are trying to find a solution other than all the copy/pasting that otherwise needs to happen between Salesforce and Excel.
SMS verification is enabled for my org. I still get email verifications. How do I change to get text only? I chose email in the past but cannot find the change back option and I feel like an idiot. Cannot find how to switch.