• enossir
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 20
    Replies
Trying to connect Einstein analytics to a local database, but i need to know exactly how such a connection is secured.

database is s4hana
For example we have a related list button in lightning does the following
  1.  select the records within the related list that you want to update (Display Checkboxes (for Multi-Record Selection)) is enabled.
  2. click the button
  3. Custom JS is ran, part of it calls on apex global methods, but at the end of the day the selected records on that related list are 'updated'. OR a simple window.open('/00O140000091FlJ?pv0={!Account.Id}'); is ran
So far I have only seen this option online: http://succeedwithsalesforce.com/multi-select-and-mass-update-records-in-lightning-list-views-using-flows-visualforce-and-a-list-button/
Flow: A screen flow that would accept user’s input and then update the selected records with the new owner

Visualforce Page: The flow would be embedded inside this Visualforce page and the page performs the primary job of passing over the selected records in the list view into a Flow SObject collection variable.

Custom List Button: This button will reference the Visualforce page and will be placed on the List view

Now if that works, couldnt i just create a VF page and then apex code instead of a flow (i hate flow builder i'd rather code). Heck, since i'm running VF coulnd't i just and call on global methods, keeping some of the if/else structure of the original JS related list button.

What's everyone's experience with migrating list view buttons from classic-->lightning.

In regards to a window.open('/00O140000091FlJ?pv0={!Account.Id}');  Could that be recreated in a standard custom link button? Would something like below work or would it not pick up the {!Account.Id}?  
 
https://<domain>.force.com/lightning/r/report00O140000091FlJ/view?fv0={!Account.Id}

I'd like to keep a button on the related list itself instead of just jamming loads of related list buttons into the lightning quick action section (the fact that you cant have lightning quick actions on related lists....is painfully bad) it makes it easy for the users, they go to the related record, they click the button, instead of trying to figure out what the buttons do from the lightning quick action section........

Has anyone been able to ghetto rig a custom button --> VF page/link ---> lightning component?
For example, as an admin is it a breach of contract to assign internal employees (who don't have an SFDC license) a customer/partner community license of some kind so that way they can file tickets? OR do they actually have to be customers/an outside business?
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
    <force:canvasApp developerName="testApp" namespacePrefix="" parameters='{"xxx":"123","yyy":"4444"}'  width="infinite" /> 
</aura:component>


<aura:application >
    <c:CanvasComp/>
</aura:application>

So when i use the canvass app previewer it works, when i try in dev console previewer it doesnt work and as a quick action it also fails.
So i'm dealing with a classic to lightning converision and have a object that has a related object in which there is a list buttton that when clicked in lightning doesn't work.
 
/apex/New_Blue?id={!Account.Id}



So since i can't do a quick action to VF page (crazy amounts of redesign)

I'm doing a quick actions ---> component ---> VF page
 
<aura:component controller="New_Blue_ctl" implements="force:appHostable,force:lightningQuickActionWithoutHeader,flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
	  <aura:handler name="init" value="{!this}" action="{!c.newBlue}"/>
</aura:component>

I use no header....because i don't want a header, i just want the Javascript to execute pass the record and start the VF page that's it nothing more.
 
({
	newBlue : function(component, event, helper) {
		    var urlEvent = $A.get("e.force:navigateToURL");
        	var recordId = component.get("v.recordId");
   			
   			
                urlEvent.setParams({
          "url": "/apex/New_Blue?id=" + recordId, 
            "isredirect": "true"
        });
        urlEvent.fire();
	}
})

Now here's the issue is when i click on the quick action 


Attempt to de-reference a null object 
For example i have a JS button i'm converting, and the lightning component that will replace it will only be excuted via a lightning quick action.
 
{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")}

var div = document.createElement("div");

div.innerHTML = '<div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.25; z-index: 1000; background-color: black;">&nbsp;</div><div style="position: fixed; left: 0; top: 0; bottom: 0; right: 0; z-index: 1001; margin: 15% 50%"><div style="display: inline-block; padding: 2px; background-color: #fff; width: 125px;"><img src="/img/loading.gif" style="float: left; margin: 8px;" /><span style="display: inline-block; padding: 10px 0px;">Please Wait...</span></div></div>';

document.body.appendChild(div);

window.setTimeout(function() {
sforce.apex.execute(
"SVC_Problem_Affected_Customers_Service",
"runFromButton",
{ actionName: "all", relevantId: "{!Account.Id}" }
);
window.location.reload();
}, 500);

There's the JS button

 
<aura:component controller="SVC_Affected_Customers_Service" implements="force:lightningQuickAction,force:hasRecordId" >
<aura:handler name="init" value="{!this}" action="{!c.runMethod}"/> 
</aura:component>

Component
 
({
	runMethod : function(component, event, helper) {
        
         var action = component.get("c.runFromButton");
         var actionName = all;
		 var relevantId = component.get("v.recordId");
         
        action.setParams({"actionName" : 'all' , relevantId : component.get("v.recordId")});
        actions.setCallBack(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var result = response.getReturnValue();
                console.log(result);
                $A.get('e.force:refreshView').fire();
            }
        })
         $A.enqueueAction(action);
  	}
})

Handler

And yes i hardcoded a var in there to equal all. Because the webservice does a check.

But back to the original question, if this is only being executed via a lightning quick action (ie a button that executes this component) do i need anything else in the component section? Google foo is failing me and the dev PDF's dont really cover this.
Yes for those who don't know these are two entirely seperate PDFs. 

So last year in 2018 when we would run our readiness report it also generated a second pdf for VF pages. It's no longer doing this, nor does the report exist in files, only the old one from 2018.

Nor does it tell me it 'cant run the report' which I noticed in some posts dating back to 2017.

No please don't point me to the lightning-config tool, that thing is utterlly useless in regards to finding issues with VF pages.

Does anyone know why this is happening, did Salesforce remove this functionality?
Here's the original JS button
 
window.open('https://tool.rss.igt.com/RSSTool/CheckSAPLicense?PERSNO='+'{!$User.EmployeeNumber}');

Here's my lightning controller
 
({
goToUrl : function(component, event, helper) {
    
    var urlEvent = $A.get("e.force:navigateToURL");
    var userId = A.get("$SObjectType.CurrentUser.Id");
    
    urlEvent.setParams({
      "url": "https://tool.rss.igt.com/RSSTool/CheckSAPLicense?PERSNO=" + userId, 
       "isredirect": "true"
    });
    urlEvent.fire();
}
})

Now all i want is a lightning quick action to make ^ above run......so what do i put in my component portion to make that happen...
 
<aura:component implements="force:lightningQuickAction" >
    
    
    <aura:attribute name="onclick" type="Aura.Action" default="{!c.goToUrl}" />    

</aura:component>



Would that work? It's not really doing any server calls...right? From what i understand the JS doing the A.get on the ("$SObjectType.CurrentUser.Id") is getting the current user without having to directly call the server to get the id. Does the client hold onto their user record while using sfdc? could i do Id.EmployeeNumber__c ?
Current we have a VF page that works fine in lightning experience, and we'll want to continue using it. The problem is initializing the page requires a JS button such as this. 

 
var w = window;
var html_doc = w.document.getElementsByTagName('head')[0]; 
var js = w.document.createElement('script'); 
  js.setAttribute('type','text/javascript'); 
  js.setAttribute('src','/support/console/31.0/integration.js'); 

html_doc.appendChild(js); 

var url = '/apex/TicketResolve?id={!Case.Id}&source=Product_Build__c&type=ticket';
             js.onload= function() { 
                    if(w.sforce.console.isInConsole() == false) { w.open(url,'_blank'); } 
                              else { 
                    navigateToUrl(url,'DETAIL','{!Case.CaseNumber}');
}

Now i'm trying to create a lightning component (initialized from a quick action) that does the same job. 

obviously the comp will need something like 
 
<aura:component implements="force:lightningQuickAction" implements='force:hasRecordId'>

To be honest i'm not sure what i'll have to add to the component section, it just needs to grab the current record id and then initaite the JS controller which is this. 
 
({
    goToUrl : function(component, event, helper) {

        var urlEvent = $A.get("e.force:navigateToURL");
        var recordId= component.get("v.recordId");

        urlEvent.setParams({
             "url": "/apex/TicketResolve?id=" + recordId + 
            "&source=SVC_Product_Build__c&type=ticket", 
            "isredirect": "true"
        });
        urlEvent.fire();
    }
$A.enqueueAction(action);
    })

Now above is just a guess of what i'll need; i wasn't sure if i need the "redirect" : "true" section...and i've seen people use ' instead of ". Also I'm wondering if the urlEvent.setParams will work.

Now does $A.enqueueAction(action); need to be there? the JS isnt calling on the server from what i understand...? It's not calling on apex methods?  i know the component.get function on the record Id is pulling from the record but isn't it getting that from the component portion of the aura bundle(which gets itself from the server) ...
 
So i have a bunch of JS buttons on an object that create a slew of child records on a different object, but they all use the same layout. 

But luckily salesforce makes this hard, because, unless i'm missing you i have to re-create the form layout for each quick action? Is this seriously the case with these?
window.open('/{!$Setup.SVC_Reporting_Ids__c.InterfaceReportId__c}?pv0={!Account.Id}');

Theres the button, now i'm trying to find the simplest way to get this to work in lightning, because theres 50 or so buttons like this, that i'll have to manually convert..(because the configurator doesn't want to do it).

This button is on a related list.

I can't for the life of me figure out the syntax to get it to work as a custom URL button. I'm thinking of just making a VF page to run a <script></script>. 

Would either of these be possible or am i stuck using lightning components....
So in the accept email from settings i put the distrobution group address, another internal corporate address and my personal email.

Only the latter two work, the distribution groups dont....i think it's due to when you send an email to said distribtion groups it retains the original sender.

Anyone figured out a way around this, or possibly an accept all function?
//Generated by wsdl2apex

public class RSSInterface {
    public class TestContractResponse_element {
        public String TestContractResult;
        private String[] TestContractResult_type_info = new String[]{'TestContractResult','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] apex_schema_type_info = new String[]{'https://test/.RSS.InterfaceService.WCF.Salesforce','true','false'};
        private String[] field_order_type_info = new String[]{'TestContractResult'};
    }
    public class TestContract_element {
        public String CustomerNumber;
        public String UserInfo;
        private String[] CustomerNumber_type_info = new String[]{'CustomerNumber','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] UserInfo_type_info = new String[]{'UserInfo','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] apex_schema_type_info = new String[]{'https://test/.RSS.InterfaceService.WCF.Salesforce','true','false'};
        private String[] field_order_type_info = new String[]{'CustomerNumber','UserInfo'};
    }
    public class CustomBinding_IWCFSalesforce {
        public String endpoint_x = 'https://test/.RSS.InterfaceService.WCF.Salesforce';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://schemas.microsoft.com/2003/10/Serialization/', 'SchemasM', 'https://test/.RSS.InterfaceService.WCF.Salesforce', 'RSSInterface'};
        public String TestContract(String CustomerNumber,String UserInfo) {
            RSSInterface.TestContract_element request_x = new RSSInterface.TestContract_element();
            request_x.CustomerNumber = CustomerNumber;
            request_x.UserInfo = UserInfo;
            RSSInterface.TestContractResponse_element response_x;
            Map<String, RSSInterface.TestContractResponse_element> response_map_x = new Map<String, RSSInterface.TestContractResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'https://test/.RSS.InterfaceService.WCF.Salesforce/IWCFSalesforce/TestContract',
              'https://test/.RSS.InterfaceService.WCF.Salesforce',
              'TestContract',
              'https://test/.RSS.InterfaceService.WCF.Salesforce',
              'TestContractResponse',
              'RSSInterface.TestContractResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.TestContractResult;
        }
    }
}

Theres my wsdl ---> apex. Now im my other controller i need to send two strings for

RSSInterface.TestContract_element test = new RSSInterface.TestContract_element(); 

And i need to define (hardcoding in)

test.CustomerNumber;
test.Userinfo:

I need one to be hello and the other to be world. I'm initating the class from a lightning quick action. But i'm bashing face to keyboard because i cannot figure out how to define those two strings...i know i'm having a 1D10T error and it could be lack of caffiene or too much.
I do a SOAP api callout from a lightning component on the case record, currently the callout is handled by the apex handler (and obviosly wsdl generated apex code)....but once you see what i'm dealing with you may advise handling it in the JS handler/helper

the string that i get on return looks somethine like this.

https://test.server.com/test/CaseNumber={!Case.CaseNumber}&OwnerEmail={!Case.Owner.Email}&CustNum={!Case.Account.Customer_Number__c}

Now how would i get my apex or JS handler to correctly fill in the blanks...also sometimes the fields change (but it's always on the case object and the values need to be from the record the user hit the component button on). I should note i can have the guy handling the webservice to send back those fields in any sort of format...so he could send it like  Case.Account.Customer_Number__c or c.Account.Customer_Number__c 

Basically i'm trying to get SFDC to fill in the field values of the string and then redirect to the URL...where I'm stuck is filling in the field values. Is there anyways i can get the APEX  to do a PageReference pageRef = new PageReference ('return string value') Where, as long as the fields are formatted correctly, it redirects?

 
Basically i have a lightning component that makes a API call to a third party server, on complete the server sends back the structure of what the URL needs to be for a URL redirect.

data the returns from API call = https://test1.com/viewcust/AccessDetails/{!Account.Customer_Number__c}?case={!Case.CaseNumber}&contacttype=RestLinkFromSalesforce

but sometimes it sends


data the returns from API call https://test2/viewcust/AccessDetails/{!Account.Number}?case={!Case.Owner}&contacttype=RestLinkFromSalesforce

It changes depending on the account. So basically it's already concatenated....

I was thinking maybe in the JS handler i could do

var  conc = data the returns from API call

and have the string from the API call be send like 

'https://test2/viewcust/AccessDetails/' + '{!Account.Number}' + '?' + 'case=' + "{!Case.Owner}' + '&' + 'contacttype' + '=' + 'RestLinkFromSalesforce'

as the format the data comes in is like this

http://<SERVER_URL>/viewcust/AccessDetails/<ALTCUST_ID>?<FIELD1_NAME>=<FIELD1_VALUE>&<FIELD2_NAME>=<FIELD2_VALUE>


I could just have the guys on the middleware system send over the string like that..... would it work and is there an easier way

 
https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_rest_callouts?trail_id=force_com_dev_intermediate

Looking at this....i see you can hardcode text to send to an external service but i need to send field data.

Basically i have a lightning component, as a button. User clicks the button and it takes a field from the current record and is supposed to send that to a third party service......So instead of sending 
 
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{"name":"mighty moose"}');
HttpResponse response = http.send(request);
// Parse the JSON response
if (response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' +
        response.getStatusCode() + ' ' + response.getStatus());
} else {
    System.debug(response.getBody());
}

Straight text like it does here, how do i send the text of a field. 
I want to implement a method for give a Salesforce User the ability to initiate a SecureLink remote session into a Customer property  via a Salesforce Ticket by simply pressing a button.

You hit the button and the SecureLink Gatekeeper will launch in a new window (if you had access and entered your credentials and then pressed the ‘Connect’ link the screen would populate with the Salesforce Ticket info we passed in).  T

Since the format of the URL to induce the SecureLink Gatekeeper to launch is structured like this:
 
http://<SERVER_URL>/viewcust/AccessDetails/<ALTCUST_ID>?<FIELD1_NAME>=<FIELD1_VALUE>&<FIELD2_NAME>=<FIELD2_VALUE>

By putting this sfdc formula within the button 
 
https://securelink.test.com/viewcust/AccessDetails/{!Account.Customer_Number__c}?case={!Case.CaseNumber}&contacttype=RestLinkFromSalesforce
results in a formatted URL.

and it works, but.....If every Account had to connect to the same SecureLink Server AND, for every Account, SecureLink needed the same fields populated, then i would be fine and not asking for help.
  1. There is more than one SecureLink Server (I think there are three).  Some Accounts connect to our standard address other Accounts connect via a second address, and the rest connect via a third address.
  2. Depending on the selected Account there are different combinations of fields that are required to be in the URL.  Ex: Some Accounts require only the Ticket Number, others require Ticket Number, Contact, & Reason,  other Accounts require a different combination, etc

The whole process SHOULD go something like this:
 
  1. An Imployees works a Ticket and decides he/she would like to initiate a remote session to the property of the Ticket’s Account.
  2. He/She presses the ‘Remote Connect’ button on the Salesforce Ticket Page.
  3. This induces Salesforce to send a message containing the Ticket’s Account’s Customer Number to the RSS Interface 
  4. The RSS Interface receives the message, pulls out the Customer Number field, looks up the information for that Customer, and in turn sends a message back to Salesforce populating fields that tell Salesforce what SecureLink Server address to send the Gatekeeper message to as well as a list of what fields Salesforce must populate in the SecureLink Gatekeeper URL message (
  5. Salesforce receives the returning message, parses out the SecureLink Server address and required fields, then populates the Gatekeeper URL message based on the SecureLink server and fields required.  This message is then sent to the SecureLink server to induce the launching of the Gatekeeper 
  6. The remote Session is initiated.
  7. The employee does their remote work and ends the session.
  8. Via Salesforce API’s the SecureLink server populates the required Session, Service, & User objects with Session data

 
I really do not know the graceful way to do this.  If the ‘SecureLink Server’ data & ‘Required SecureLink Fields’ data existed as fields within the Salesforce Account objects I could dynamically construct the URL Gatekeeper message.  But sending, receiving, & parsing returning messages to & from the RSS Interface to dynamically determine the Server & Required Fields data is beyond my knowledge.

If anyone has seen something similar to this before, or has seen any related documention please feel free to direct me there.

 
So if you use a before trigger to update values but to make sure they don't conflict with a specific validation rule you put in the validation rule NOT(ISCHANGED or PRIORVALUE != would that work...or does the ischanged/priorvalue not base it's information from the original file but it sees the prior value as whatever the before trigger put into it?
// before update, process only trigger.new opps and trigger.old maps 
    public static void befUpdate(List<Opportunity> newOpps, Map<Id,Opportunity> oldMapOpps){    
        oppFldUpdates(newOpps,oldMapOpps);
        OppFiscalQuarterDates(newOpps);
        validateOppUpdate(newIGTOpps,oldMapOpps);      
       
         for (Opportunity opp : newOpps){
            if(opp.Signature_Received__c == true) opp.StageName = 'Closed Won';
            if(opp.StageName == 'Closed Won')opp.CloseDate = date.today();     
             }
        
    }

So when the opp stagename is closed won then the close date is switched to today, no i didnt use a workflow because theres too much business logic on other handlers that work off the opportunity install and close dates.

but the problem is, is when the install date > close date before this class updates. Ie

install date = 1/13/2019
close date = 1/4/2019  apex class field update ---> 1/2/2019

but what fires off is this
 
AND(Install_Date__c <= CloseDate, 
ISPICKVAL( Term_Conversion__c ,"")
)


Because it's reading the previous value of the closedate, now these are on old opps obviously....but a lot of them are like this. I'd really hate to have to hard code another validation rule into my class handler.
For example, as an admin is it a breach of contract to assign internal employees (who don't have an SFDC license) a customer/partner community license of some kind so that way they can file tickets? OR do they actually have to be customers/an outside business?
So i'm dealing with a classic to lightning converision and have a object that has a related object in which there is a list buttton that when clicked in lightning doesn't work.
 
/apex/New_Blue?id={!Account.Id}



So since i can't do a quick action to VF page (crazy amounts of redesign)

I'm doing a quick actions ---> component ---> VF page
 
<aura:component controller="New_Blue_ctl" implements="force:appHostable,force:lightningQuickActionWithoutHeader,flexipage:availableForAllPageTypes,force:hasRecordId" access="global" >
	  <aura:handler name="init" value="{!this}" action="{!c.newBlue}"/>
</aura:component>

I use no header....because i don't want a header, i just want the Javascript to execute pass the record and start the VF page that's it nothing more.
 
({
	newBlue : function(component, event, helper) {
		    var urlEvent = $A.get("e.force:navigateToURL");
        	var recordId = component.get("v.recordId");
   			
   			
                urlEvent.setParams({
          "url": "/apex/New_Blue?id=" + recordId, 
            "isredirect": "true"
        });
        urlEvent.fire();
	}
})

Now here's the issue is when i click on the quick action 


Attempt to de-reference a null object 
So i have a bunch of JS buttons on an object that create a slew of child records on a different object, but they all use the same layout. 

But luckily salesforce makes this hard, because, unless i'm missing you i have to re-create the form layout for each quick action? Is this seriously the case with these?
So in the accept email from settings i put the distrobution group address, another internal corporate address and my personal email.

Only the latter two work, the distribution groups dont....i think it's due to when you send an email to said distribtion groups it retains the original sender.

Anyone figured out a way around this, or possibly an accept all function?
//Generated by wsdl2apex

public class RSSInterface {
    public class TestContractResponse_element {
        public String TestContractResult;
        private String[] TestContractResult_type_info = new String[]{'TestContractResult','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] apex_schema_type_info = new String[]{'https://test/.RSS.InterfaceService.WCF.Salesforce','true','false'};
        private String[] field_order_type_info = new String[]{'TestContractResult'};
    }
    public class TestContract_element {
        public String CustomerNumber;
        public String UserInfo;
        private String[] CustomerNumber_type_info = new String[]{'CustomerNumber','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] UserInfo_type_info = new String[]{'UserInfo','https://test/.RSS.InterfaceService.WCF.Salesforce',null,'0','1','true'};
        private String[] apex_schema_type_info = new String[]{'https://test/.RSS.InterfaceService.WCF.Salesforce','true','false'};
        private String[] field_order_type_info = new String[]{'CustomerNumber','UserInfo'};
    }
    public class CustomBinding_IWCFSalesforce {
        public String endpoint_x = 'https://test/.RSS.InterfaceService.WCF.Salesforce';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://schemas.microsoft.com/2003/10/Serialization/', 'SchemasM', 'https://test/.RSS.InterfaceService.WCF.Salesforce', 'RSSInterface'};
        public String TestContract(String CustomerNumber,String UserInfo) {
            RSSInterface.TestContract_element request_x = new RSSInterface.TestContract_element();
            request_x.CustomerNumber = CustomerNumber;
            request_x.UserInfo = UserInfo;
            RSSInterface.TestContractResponse_element response_x;
            Map<String, RSSInterface.TestContractResponse_element> response_map_x = new Map<String, RSSInterface.TestContractResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'https://test/.RSS.InterfaceService.WCF.Salesforce/IWCFSalesforce/TestContract',
              'https://test/.RSS.InterfaceService.WCF.Salesforce',
              'TestContract',
              'https://test/.RSS.InterfaceService.WCF.Salesforce',
              'TestContractResponse',
              'RSSInterface.TestContractResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.TestContractResult;
        }
    }
}

Theres my wsdl ---> apex. Now im my other controller i need to send two strings for

RSSInterface.TestContract_element test = new RSSInterface.TestContract_element(); 

And i need to define (hardcoding in)

test.CustomerNumber;
test.Userinfo:

I need one to be hello and the other to be world. I'm initating the class from a lightning quick action. But i'm bashing face to keyboard because i cannot figure out how to define those two strings...i know i'm having a 1D10T error and it could be lack of caffiene or too much.
So if you use a before trigger to update values but to make sure they don't conflict with a specific validation rule you put in the validation rule NOT(ISCHANGED or PRIORVALUE != would that work...or does the ischanged/priorvalue not base it's information from the original file but it sees the prior value as whatever the before trigger put into it?
Hi,
  I have an  Apex class, While writing the test class I'm able to get the code coverage only 47%. But I was stuck at  this point only
Please, anyone, help on this.
  
My Apex Class
public class updatemonitoringservice{
    public static void UpdateMonitoring(List<Account> newlist){
        //Get list of Account records.        
system.debug('inside helper');        
    set<Id> accId = new set<Id>();
        for(Account acc : newList){
            accId.add(acc.id); //Adding accountId's to Set.      
             }
    List<Account> accList = [select id, Name, Suspend__c,(select id,Status__c,prior_status__c,
                         prior_monitoring_service__c,Monitoring_Service__c from Installations__r) from Account where Id=:accId]; //Fetch Account related Installations.
      map<Id,List<Installation__c>> mapInst = new map<Id,List<Installation__c>>();
        for(Account accVar : accList){
            mapInst.put(accVar.Id,accVar.Installations__r); // addAll Id's & installations to the Map.
        }
  system.debug('mapInst::'+mapInst);
       List<Installation__c> updateInst = new List<Installation__c>();
      List<Installation__c> upInstallation = new List<Installation__c>();
      
        for(Account a : accList){
                                       
           if(a.Suspend__c)
              {
            
                system.debug('a.Suspend__c::'+a.Suspend__c);
               updateInst.addAll(mapInst.get(a.Id));  // get Id's and add to updateInst list.
               
            }
        
           if(!a.Suspend__c)
            {
                system.debug('a.Suspend__c::'+a.Suspend__c);
                upInstallation.addALL(mapInst.get(a.Id)); // get Id's and add to upInstallation list.
            } 
        }
        List<Installation__c> installationsToUpdate = new List<Installation__c>(); //List for updating the record.      
        
        for(Installation__c instVar:updateInst) //if Suspend equals to true update status and monitoring service values & 
                                                // capture old values in prior_status__c and prior_monitoring_service__c.
        {
            system.debug('inside true');
            system.debug('prior_monitoring_service__c::'+instVar.prior_monitoring_service__c);
            system.debug('monitoring_service__c::'+instVar.Monitoring_Service__c);
            
          system.debug('************************');
           system.debug('prior_status__c::'+instVar.prior_status__c);
           system.debug('Status__c::'+instVar.Status__c);
            if(instVar.Status__c !='5-Removed' && instVar.Status__c !='6-Canceled' && instVar.Status__c !='Swapped-Out' 
               && instVar.Status__c !='Abandoned'){
                 
             if(instVar.Status__c !='Suspend')
                instVar.prior_status__c = instVar.Status__c;
               
           // if(instVar.Monitoring_Service__c != 'Client')             
                instVar.prior_monitoring_service__c = instVar.Monitoring_Service__c;          
           
            instVar.Status__c = 'Suspend';
            instVar.Monitoring_Service__c = 'Client';
            installationsToUpdate.add(instVar);
        
          }
        }
        for(Installation__c instVar : upInstallation) //if Suspend equals to false revert old values in status and monitoring fields.
        {
            system.debug('inside false');
            boolean isRemovePriorChanged = true;
            if(instVar.Status__c !='5-Removed' && instVar.Status__c !='6-Canceled' && instVar.Status__c !='Swapped-Out' 
               && instVar.Status__c !='Abandoned'){
              if(instVar.prior_status__c != null && instVar.prior_monitoring_service__c !=null){
                       
                   
                instVar.Status__c =  instVar.prior_status__c ;
                instVar.Monitoring_Service__c = instVar.prior_monitoring_service__c;
                  
            if(isRemovePriorChanged && instVar.Status__c != NULL && instVar.Monitoring_Service__c != NULL)
            {
                instVar.prior_status__c = NULL;
                instVar.prior_monitoring_service__c = NULL;
                system.debug('Priorstatus value::'+instVar.prior_status__c);
                system.debug('Priormoniotoring service value::'+instVar.prior_monitoring_service__c);
            }          
            installationsToUpdate.add(instVar);
          }
         }
        } 
        update installationsToUpdate;    
 }  
}

My Test Class
@isTest
public class updatemonitoringtestclass {
    public static testMethod void testing(){    
      List<Account> acc = new List<Account>();
        Account a1 = new Account();
        a1.Name = 'test';
        a1.Type = 'Prospect';
        a1.Channel__c = 'Direct';
         a1.Suspend__c = true;
        acc.add(a1);
        insert acc;       
       
        Contact con = new Contact();
        con.LastName = 'Vgs';
        insert con;    
        
       Case ca = new Case();
        ca.Type ='Account Change';
        ca.Status ='01-New';
        ca.Subject ='test new';
        ca.Description = 'new Description';
        ca.AccountId= a1.id;
        ca.ContactId = con.id;  
        insert ca;
        
       Opportunity opp = new Opportunity();
        opp.Name = 'test1';
        opp.Type = 'Existing Business';
        opp.CloseDate = system.today();
        opp.StageName = '01-Discovery';
        opp.Prospect_Level__c = 'A';
        opp.LeadSource = 'web';
        opp.AccountId = a1.id; 
        insert opp;
        
       List<Installation__c> instList = new List<Installation__c>();
       Installation__c inst = new Installation__c();
        inst.Name__c ='instal';
        inst.Status__c = 'Suspend';
        inst.Monitoring_Service__c = 'Client';   
         inst.Site__c = a1.id;
        inst.prior_status__c = '0-New';
        inst.prior_monitoring_service__c = 'Live';
        inst.Install_Case__c = ca.id;
         inst.Opportunity__c = opp.id;
        instList.add(inst);
        insert inst;      
        
       a1.Suspend__c = true ;
       update acc;   
        List<Installation__c> instal = [select id,Status__c,prior_status__c,
                         prior_monitoring_service__c,Monitoring_Service__c from Installation__c where Id=:instList];
        for(Installation__c ins : instal){
            System.assertEquals('Suspend',ins.Status__c);
            System.assertEquals('Client',ins.Monitoring_Service__c);
          //  system.assertEquals(ins.Monitoring_Service__c,ins.prior_monitoring_service__c);
           // system.assertEquals(ins.Status__c,ins.prior_status__c);
            a1.Suspend__c=false;
            update acc;
   
                    }
        }     
    }
  • January 29, 2019
  • Like
  • 0
Now i have a text field called Other__c that needs to display if a related lookup value is selected the Symptoms__c field. The reason the Symptoms__c field is a lookup field is because the values in that field are related to a seperate lookup called Machine__c...that's not important. But every machine has a related "Other" Symptoms__c record.

How it currently works is when you select a machine the page refreshes and loads the corresponding values of the Symptoms. 

12:59:39:038 USER_DEBUG [95]|DEBUG|
(System.SelectOption[value="a1K2a000000CgJcEAK", label="Configuration", disabled="false"],
 System.SelectOption[value="a1K2a000000k5sYEAQ", label="Other", disabled="false"])

for example if i selected machine test i'd get these two possible selections. 

Now after i select Other as the symptom i was the Other__c field to display on the VF page. 

Currently i have a mess of VF, method and JS just to get the machine-->symptoms to work but that's because it's reloading a related list and having it display as a picklist. I feel like this one should be easymoney because it's just a if value is selected on the page then render.



 
So we pull data from SAP quotes/sales and push it into a custom object in SFDC.

How we reference the records in SFDC to the ones in SAP is via the SAP sales doc #. In fact when you view this is Informatica you can see in both SAP and SFDC the Sales doc. and SAP_Sales_Doc__c and keys. 

Now theres another field ORCL in SAP it's a boolen value true/false (or X/blank) and i need to push that to the related records in SFDC. The problem is when i try to us data synchronization it tells me "The ID field in salesforce.com object must be mapped for update." How the hell am i supposed to map to this field when there's nothing in SAP that references that.....the only reference to records i have is via the SAP sales doc.
private static void process(Account account) {
        teamRoles = Account_Team_Roles__c.getAll();
process(account, AccountRoleCustomSettingsNames.STRATEGIC_ACCOUNT_DIRECTOR, account.Strategic_Account_Mgr__c); process(account, AccountRoleCustomSettingsNames.STRATEGIC_ACCOUNT_SYSTEM_SALES, account.Strategic_Acct_System_Sales__c); 
process(account, AccountRoleCustomSettingsNames.STRATEGIC_ACCT_VP, account.Strategic_Acct_VP__c); if(account.Region__c != 'Asia' || account.Region__c != 'ANZ') process(account, AccountRoleCustomSettingsNames.SYSTEM_AM, account.System_AM__c); 
else process(account, AccountRoleCustomSettingsNames.SYSTEM_AM_APAC, account.System_AM__c);
 process(account, AccountRoleCustomSettingsNames.SYSTEM_SALES_DIRECTOR, account.Systems_Sales_Director__c);


Now all the other 'AccountRoleCustomSettingsNames.<api name>' work. 

So yestarday i go into custom settings and then into a prexisting custom settings defintion, one that manages account team roles. Then i hit manage and create a new team role named, 'System AM APAC'

In dev console i get 

'Variable does not exist: SYSTEM_AM_APAC'

So i checked in account teams, and it dawns on me "There isn't an account team named 'System AM APAC'" so i created one, and still I get the Variable does not exist error...
 
I'm trying to compare data from querys on two different objects.

Object 1: Opportunity

Object 2: OpportunityFieldHistory

Now object 2 has the 'OpportunityId' field which matches up with, you guessed it, the opportunity object Id field. So what I'm trying to do is 

Pull information on two fields from the opportunity Object, these two fields would have been modified so the data in them is not null (as an AND statement not OR i need them both to be not null). Now i want to fix the modifications made to those fields within around 800 or so opportunities. 

Thats where the field history comes in. It has the Old data that i want, but i need to pull the correct opportunities ID's out and then cross reference them with a set from the field history and fitler out the field history data i actually want.

sooo

healp me please