• Ron Mccrerey 20
  • NEWBIE
  • 40 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 13
    Replies
SOQL Query:
Select (Select product2.Name From OpportunityLineItems)  From Opportunity  
        Where Id IN 
        (Select OpportunityId from opportunityLineItem where Name  like '%LS00425%')
Returns: [{"Product2":{"attributes":{"type":"Product2","url":"/services/data/v48.0/sobjects/Product2/01t1I000004O9fMQAS"},"Name":"STE9923"}},{"Product2":{"attributes":{"type":"Product2","url":"/services/data/v48.0/sobjects/Product2/01t1I000004OzGwQAK"},"Name":"LS00425"}}]

Apex Query:
List<Opportunity> myOpportunity = [Select (Select product2.Name From OpportunityLineItems)  From Opportunity  
        Where Id IN 
        (Select OpportunityId from opportunityLineItem where Name  like '%LS00425%')];
Returns:
(Opportunity:{Id=0061I00000JT2c5QAD, RecordTypeId=0121I000000NvQqQAK})
Get the above error when trying to create an OpportunityContactRole record using LWC.

javascript Code

import retrieveOppContactRoles from '@salesforce/apex/getLastIncrementSTENum.getOppContactRoles';

let fields = {
ContactId: iterator.ContactId,
OpportunityId: oppId
}

createRecord({apiName: OPPORTUNITY_CONTACT_ROLE_OBJECT.objectApiName, fields })
.catch(error =>{ console.log( error); });

Error in Console
body:
errorCode: "INVALID_TYPE"
message: "Object OpportunityContactRole is not supported in UI API"
statusCode: 400
Is the wire service in LWC Synchronous or Asynchronous?  Is there a way to capture data from a wire inquiry and use it in a second wire service. Can you call a wire service or is it only  called when the component is loaded? Can LWC be used in a 3rd party App with Angular or React?
LCC.callApex('LCCController.getUser', params, this.resultHandler,
{escape: true });

 returns error Unable to invoke action 'LCCController.getUser': no controller and/or function found

Here is my Manifest.json
{
"landing-pages" : [
{
"path": "index.html",
"apex-controller": "LCCControler"
}
]
}

Here is the Controller:
global class LCCController {
    @AuraEnabled(cacheable=true)
    @RemoteAction
    global static List<User> getUser() {
        UserInfo.getUserId();
        List<User> me = new List<User>();
        me = [Select FirstName, LastName from User where Id = :UserInfo.getUserId()];
        System.debug('Out 7' + me);
        return me;
    }
}
Created Lookup Relationship field on Product with a Child Relationship fo Product.
I then  added a lookup filter:
Product: Product Record Type equals Value Chassis
and Product: Status equals Value Available

I get the message:
No records found due to one of the following:
There are no records of this type              -- There are records of this type
You don't have permission to see any of the records            -- I do have permission
Records do not fit the filter criteria set by your administrator   -- Not sure what this means
One or more controlling fields are blank or invalid (Controlling fields: Product Record Type, Status)  --Not sure what this means
 
How do you get LWC to recognize compound fields? (rstk__poline_ordno__r.Name)
LWC does not appear to recognize compound fields names.
public static String getProjectNumber( String id ) {
List<Opportunity> values = new List<Opportunity>();
values =
// return
[SELECT Id, Name, (SELECT PricebookEntry.Product2.Serial_Number__c,
PricebookEntry.Product2.Stock_ID__c,
PricebookEntry.Product2.RecordType.Name
FROM OpportunityLineItems
where PricebookEntry.Product2.RecordType.Name = 'Service Body' )
FROM Opportunity WHERE Id = :id limit 1];
return values.PricebookEntry.Product2.Serial_Number__c;
}

Get error Variable does not exist: PricebookEntry

Here is the data:
PricebookEntry.Product2.Serial_Number__c             STETEST
PricebookEntry.Product2.Stock_ID__c                             PricebookEntry.Product2.RecordType.Name             Service Body
Set up a simple lightning container and at the work office we get the following error when resolving host: 'summittruck--stenumber--c.container.lightning.com’s server IP address could not be found.'

At home office the application and container load as expected with no issues.

What might be keeping the container from loading in our office enviroment.
Can anyone give and example of using LCC.addMessageHandler in an Angular application?
I am trying to deploy an Angular2 SPA application.  Everything seems to be workig except the intial route.
Get the following  Error: Cannot match any routes. URL Segment: 'lcc/1529093753000/container/index.html'
I wrote the communication from Visual Force to Lightning Component as shown here:
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html

It worked great in the sandbox environment with no problems.
But when I deployed to production I get the following error:
Uncaught DOMException: Blocked a frame with origin "https://domain Name.visual.force.com" from accessing a cross-origin frame.
    at window_blur (chrome-extension://ddaloccgjfibfpkalenodgehlhkgoahe/jslib/nuanria.FrameConnector.js:338:18)
 
I have and Angular App hosted by Visual Force in Lightning Experience. When I navigate using the routeing in my Angular App a new page pops up with "URL No Longer Exists You have attempted to reach a URL that no longer exists on salesforce.com. " but on the original page the navigation is correct. Can anybody tell how to stop the "URL No Longer Exist" page from opening?

This does not occur when working in classic
How do I pass a recordId (or other saleforce page info) to an Angular2 SPA wrapped in Visual Force in Lightning with My-Domain enabled?
In classic I was launching an Angular Application wrapped in a Visualforce page from a button that passed URL parameters.  How do I get this functionality to work in Lightning. Passing URL parameters (ie current opportunity ID) ?  Examples are appreciated.

I have created a List Button with Content Source as 'URL'.  https://summittruck--remdev--c.cs91.visual.force.com/apex/LightningTestIndex
?&Opportunity={!Opportunity.Id.   When I click on the button this parameter does not show up in the URL

This is what is generated in the URL https://summittruck--remdev.cs91.my.salesforce.com/servlet/servlet.Integration?scontrolCaching=1&lid=00b2F000000ILP7&eid=0062F000004Nq1u&ic=1&linkToken=VmpFPSxNakF4T0Mwd05DMHhObFF4TkRveU1Eb3pNeTQ1T0RoYSxCOFk3RzNsc0Z0VDJRNWhTZW5kcE8wLFlXWmtNR0po
 
Get error on Lightning Components Basic: Challenge Not yet complete... here's what's wrong: Could not find the 'Expense__c' custom object with the correct fields.

I have checked the object and all fields are there.
 
Is the wire service in LWC Synchronous or Asynchronous?  Is there a way to capture data from a wire inquiry and use it in a second wire service. Can you call a wire service or is it only  called when the component is loaded? Can LWC be used in a 3rd party App with Angular or React?
LCC.callApex('LCCController.getUser', params, this.resultHandler,
{escape: true });

 returns error Unable to invoke action 'LCCController.getUser': no controller and/or function found

Here is my Manifest.json
{
"landing-pages" : [
{
"path": "index.html",
"apex-controller": "LCCControler"
}
]
}

Here is the Controller:
global class LCCController {
    @AuraEnabled(cacheable=true)
    @RemoteAction
    global static List<User> getUser() {
        UserInfo.getUserId();
        List<User> me = new List<User>();
        me = [Select FirstName, LastName from User where Id = :UserInfo.getUserId()];
        System.debug('Out 7' + me);
        return me;
    }
}
How do you get LWC to recognize compound fields? (rstk__poline_ordno__r.Name)
LWC does not appear to recognize compound fields names.
public static String getProjectNumber( String id ) {
List<Opportunity> values = new List<Opportunity>();
values =
// return
[SELECT Id, Name, (SELECT PricebookEntry.Product2.Serial_Number__c,
PricebookEntry.Product2.Stock_ID__c,
PricebookEntry.Product2.RecordType.Name
FROM OpportunityLineItems
where PricebookEntry.Product2.RecordType.Name = 'Service Body' )
FROM Opportunity WHERE Id = :id limit 1];
return values.PricebookEntry.Product2.Serial_Number__c;
}

Get error Variable does not exist: PricebookEntry

Here is the data:
PricebookEntry.Product2.Serial_Number__c             STETEST
PricebookEntry.Product2.Stock_ID__c                             PricebookEntry.Product2.RecordType.Name             Service Body
Set up a simple lightning container and at the work office we get the following error when resolving host: 'summittruck--stenumber--c.container.lightning.com’s server IP address could not be found.'

At home office the application and container load as expected with no issues.

What might be keeping the container from loading in our office enviroment.
I wrote the communication from Visual Force to Lightning Component as shown here:
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html

It worked great in the sandbox environment with no problems.
But when I deployed to production I get the following error:
Uncaught DOMException: Blocked a frame with origin "https://domain Name.visual.force.com" from accessing a cross-origin frame.
    at window_blur (chrome-extension://ddaloccgjfibfpkalenodgehlhkgoahe/jslib/nuanria.FrameConnector.js:338:18)
 
How do I pass a recordId (or other saleforce page info) to an Angular2 SPA wrapped in Visual Force in Lightning with My-Domain enabled?
Issue: Lightning Container loading a jquery fileupload widget as a static resource - throws "403 Forbidden" error in container.js

Plain iframe works
    <iframe src="/resource/jqfileupload/fileupload/index.html"></iframe>
Same static resource fails in lightning container with 403    
    <lightning:container src="{!$Resource.jqfileupload + '/fileupload/index.html'}"/>

Any help is greatly appreciated. Thanks!

 
In my test class I insert new products and pricebookentries, in my test class I don't use seeAllDate=true annotation and in order to retrieve standard pricebook id I used Test.getStandardPricebookId() method, here's my code:
Product2 p1 = new Product2(Name='Product Monthly 1111', Family='Monthly', isActive=true, CurrencyIsoCode='USD');
Product2 p2 = new Product2(Name='Product Yearly 2222', Family='Yearly', isActive=true, CurrencyIsoCode='USD');

insert new List<Product2>{p1, p2};

Id pricebookId = Test.getStandardPricebookId();

PricebookEntry pbe1 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p1.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=100);
PricebookEntry pbe2 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p2.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=50);

insert pbe1;
insert pbe2;

List<PricebookEntry> pbes = [SELECT ID FROM PricebookEntry 
    WHERE Product2id IN (:p1.Id, :p2.Id) AND Pricebook2.isStandard = TRUE AND Pricebook2.isActive = TRUE AND CurrencyIsoCode = 'USD' AND isActive = TRUE];

System.assertEquals(2, pbes.size());


pbes.size() returns 0. I used the same query in console for existing data and I got results. What am I doing wrong?