I'm trying to convert a JS button into lightning.
{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")}
var numTCs = {!Sales_Toolkit__c.Number_of_Theme_Conversions__c};
var curStatus = '{!Sales_Toolkit__c.Current_Status__c}';
if(numTCs == 0) {
alert('You must have at least one game title added before submitting this configuration.');
} else {
var sID = '{!$Api.Session_ID}';
var ddpIds = '{!IF(Sales_Toolkit__c.Is_Ticket_Created__c=='False', 'a4n1O0000008gHA', 'a4n1O0000008gHB')}';
var eID = '{!Sales_Toolkit__c.Id}';
window.location.href = '/apex/loop__looplus?eid=' + eID + '&sessionid=' + sID + '&ddpIds=' + ddpIds + '&autorun=true';
}
It's a button to retrieve some of the current records info, session ID, and then push to a application called drawloop which then creates an attachment on the record.
Originally i just pushed all the code into a Visual Force Page and used that to create an action. But that doesn't work on the Mobile app which is the problem.
I've done this on the component end
<aura:component implements="force:lightningQuickAction,force:hasRecordId,force:hasSObjectName" >
<aura:attribute name="recordId" type="String" />
<aura:attribute name="Sales_Toolkit__c" type="String" />
<lightning:button label="Test LComponent Submit Blue"
onclick="{!c.myaction}" />
</aura:component>
But back to the JS, how do i refer to objects and their associated fields? API session ID? Google is failing me, i know i'm probably not asking it the right way.
When i copypasta the JS into the Controller (Except the requirescript) i instantly get "Parsing error: Unexpected token !" on line 5
EDIT
({
myAction : function(component, event, helper) {
var numTCs = component.get(Sales_Toolkit__c.Number_of_Theme_Conversions__c);
var curStatus = component.get(!Sales_Toolkit__c.Current_Status__c);
if(numTCs == 0) {
alert('You must have at least one game title added before submitting this configuration.');
} else {
var sID = '{!$Api.Session_ID}';
**var ddpIds = '{!IF(Sales_Toolkit__c.Is_Ticket_Created__c=='False', 'a4n1O0000008gHA', 'a4n1O0000008gHB')}';**
var eID = '{!Sales_Toolkit__c.Id}';
window.location.href = '/apex/loop__looplus?eid=' + eID + '&sessionid=' + sID + '&ddpIds=' + ddpIds + '&autorun=true';
}
}
})
Did the above, now "Parsing Error: unexpected token False" under the !If(Sales_Toolkit__c portion marked above with **
EDIT 2: anyone know how to do
window.location.href = '/apex/loop__looplus?eid=' + eID + '&sessionid=' + sID + '&ddpIds=' + ddpIds + '&autorun=true';
a page redirect like that one...without actually having it affect the user? Like doing it to a pseudo user in apex? Basically that URL redirect takes those Vars and with the autorun starts an application called drawloop which creates an attachment for the record.