• Kallu Kalia
  • NEWBIE
  • 0 Points
  • Member since 2020


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
I am trying to put some styling to my table with a border-radius in my visualforce page but when rendered to pdf I dont see the rounded corners.
 
<apex:page standardController="Quote" renderAs="advanced_pdf" cache="false" applyHtmlTag="false" applyBodyTag="false" standardStylesheets="false" showHeader="false" sidebar="false">
    <html>
        <head>
            <style>
                .rcorners1 {
                border-radius: 50px;
                border: 2px solid #000;
                padding: 20px; 
                width: 200px;
                height: 150px;    
                }
                @media print {
                border-radius: 50px;
                border: 2px solid #000;
                padding: 20px; 
                width: 200px;
                height: 150px;   
                }
            </style>
        </head>
        <body>
            <table style="border: 1px solid black; border-radius:50px">
                <tr>
                    <td>
                        test
                    </td>
                </tr>
            </table>
            <p class="rcorners1">Lets look if this works</p>
        </body>
    </html>    
</apex:page>

 
Dear Community  

I am buiding the test class for Validation rule that block users with Permission Set assigned and proper record type from editing certaint  fields. 

I keep running into the issue.  
Error Message   System.AssertException: Assertion Failed: Validation rule should throw correct error.: Expected: true, Actual: false
Stack Trace              Class.Test_VR_FSRNAAssetBlockEdit.Test_FSRNABlockPIMSEdit: line 215, column 1

Where I testing update of the Account ID.  
Line 215 is failing
System.assertEquals(true, validError, 'Validation rule should throw correct error.');

Any advise on how to fix the error would be much appriciated? 
Thnak you in advance. 
Kasia 
@isTest
public class Test_VR_FSRNAAssetBlockEdit {
    
    
    private class TestException extends Exception {}

    static final string PERM_SET = 'FSR_NA_DBR_Setup_and_Installation_Permissions';
    
    
    @testSetup
    public static void dataSetup() {
      // create test user with Field Support Rep NA profile 
    Profile FSRNA = [SELECT Id, Name FROM Profile WHERE Name = 'Field Support Rep - CAG'];
        

        User u = new User(
            Alias = 'CTSvTest',
            Email = 'TestAssetValidationRuleFSRNA@XXXX.com',
            Username = 'TestAssetValidationRS@XXXX.com',
            FirstName = 'CTS Test',
            LastName = 'UserAssetVR',
            TimeZoneSidKey = 'America/New_York',
            LocaleSidKey = 'en_US',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            ProfileId = FSRNA.Id
        );

        insert u;
        
        // need to assign user to permission set
        PermissionSet ps = [SELECT Id FROM PermissionSet WHERE Name = :PERM_SET];
    
        PermissionSetAssignment psa = new PermissionSetAssignment(
        PermissionSetId = ps.Id,
        AssigneeId = u.Id
        );
        insert psa;
        
        // Make Account
        Account acc = new Account();
        acc.Name = 'TestAccount';
        acc.BillingCity ='Boston' ;
        acc.BillingCountry='United States';
        acc.BillingPostalCode='600075';
        acc.BillingState=' Massachusetts';
        acc.BillingStreet='water well street';
        acc.ShippingCity ='Boston' ;
        acc.ShippingCountry='United States';
        acc.ShippingPostalCode='600075';
        acc.ShippingState=' Massachusetts';
        acc.ShippingStreet='water well street'; 
        acc.TIN__c = '1';

        System.runAs(u) {
            insert acc;
        }
    }  
    @IsTest
    static void Test_FSRNABlockPIMSEdit () {
        // Get Record Type
        Id assetRecordTypeId = Schema.SObjectType.Asset.getRecordTypeInfosByDeveloperName().get('XXXX_Practice_Information_Mgmt').getRecordTypeId();
        User u = [ SELECT Id FROM User WHERE Username = 'TestAssetValidationRS@XXXX.com' LIMIT 1 ];
        Account acc = [ SELECT Id FROM Account WHERE Name = 'TestAccount' LIMIT 1 ];

        Asset product = new Asset();
        product.Status = 'Installed';
        product.Is_Active__c = true;
        product.SerialNumber = 'TA001';
        product.RecordTypeId = assetRecordTypeId;
        product.AccountId = acc.Id;
        product.Asset_Category__c = 'Practice Software';
        product.Activation_Key__c = '1234-5678-90';
        product.Name = 'Cornerstone';
        insert product;

        // Test edit of activation key
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.Activation_Key__c = '0912-5678-90';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.Activation_Key__c = '0912-5678-90';
        }

        // Test edit of PIMS installed sw version
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.PIMS_Installed_SW_Version__c = '8.5.01.2';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.PIMS_Installed_SW_Version__c = '8.5.01.3';
        }

        // Test edit of PIMS primary OS
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.PIMS_Primary_Operating_System__c = 'Macintosh';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.PIMS_Primary_Operating_System__c = 'Windows';
        }

        // Test edit of Service Level
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.PIMS_Service_Level__c = 'Gold';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.PIMS_Service_Level__c  = 'Silver';
        }

       
       // Test edit of XXXX Unique Key
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.SAP_Cust_No_Type_ID__c = '1';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.SAP_Cust_No_Type_ID__c  = '2';
        }
        
       // Test edit of Version
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.Version__c = '1';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.Version__c  = '2';
        }
        
        // Test edit of PIMS Poeple ID 
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.PIMS_People_ID__c = 122222;
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.PIMS_People_ID__c = 122222;
        }
        
       // Test edit of Account Id 
        try {
            System.runAs(u) {
                product.Name = 'Cornerstone';
                product.AccountId = 'ABC Clinic';
                update product;
        }
            throw new TestException('Failed to throw correctly');
        } catch (Exception e) {
            String errorMessage = e.getMessage();
            Boolean validError = errorMessage.contains('You cannot edit XXXX Products and Services record.');
            System.assertEquals(true, validError, 'Validation rule should throw correct error.');
        }

        System.runAs(u){
            product.AccountId = 'ABC Test Clinic';
        }

 
I am trying to create a post that can take in more than one record at a time. I am hitting a bit of a brick wall and was hoping someone could help me with an answer. how would I allow this to take in multiple employee records together.

    public static HttpResponse PostEmployeeCallout(){
        http http = new http ();
        HttpRequest request = new HttpRequest();
        //Set the Endpoint of the Post callout
        request.setEndpoint('https://sfdnewhires.herokuapp.com/api/v3/employees');
        //Set the method to be a post callout
        request.setMethod('POST');
        //declairing the header type and the format of the response
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        list <object> employees = (List<Object>) results.get('employees');
        request.setBody(body);
        HttpResponse response = http.send(request);       
    }
    public class body{
        String Name {get;set;}
        String hire_Date {get;set;}
        String position {get;set;}
        String email {get;set;}
        Integer phone {get;set;}
        String functional_area {get;set;}
        String Location {get;set;}
        String type {get;set;}
    }
    public body(String Name, String hire_Date, String position, String email, Integer phone, String functional_area, String Location, String type){
        this.name = name;
        this.hire_date = hire_Date;
        this.position = position;
        this.email = email;
        this.phone = phone;
        this.functional_area = functional_area;
        this. location = Location;
        this.type = type;
    }
}

 
Hello,

Is it possible to achieve this functionality?

I would like to override the standard New button with visualforce page, which I know is possible, but based on some criteria I want to call a either a custom lightning component or the standard New button functionality. I will be using a controller to check my criteria but want to know how to use the standard New button functionality if the criteria does not meet. How to leverage the standard New button functionality?

Thanks.
public with sharing class CaseLwc {
public CaseLwc() {
}
@AuraEnabled(cacheable=true)
public static List<FetchValueWrapper> getPicklistValues(sObject objInfo,string picklistFieldApi){
Schema.DescribeSObjectResult objDescribe = objInfo.getSObjectType().getDescribe();
Map< string, Schema.SObjectField> fieldMap= objDescribe.fields.getMap();
List<Schema.picklistEntry> values=fieldMap.get(picklistFieldApi).getDescribe().getPicklistValues();
system.debug('values-----'+values);
List<FetchValueWrapper> objWrapper=new List<FetchValueWrapper>();
for(Schema.picklistEntry p:values){
FetchValueWrapper fw = new FetchValueWrapper();
fw.slabel=p.getlabel();
fw.svalue=p.getvalue();
objWrapper.add(fw);
system.debug('Map-----'+objWrapper);
}
return objWrapper;
}
/* @AuraEnabled(cacheable=true)
public static List<String> getCaseFields(){
SObjectType caseType = Schema.getGlobalDescribe().get('Case');
Map<String,Schema.SObjectField> mfields = caseType.getDescribe().fields.getMap();
system.debug('fields------'+mfields);
List<String> sObjectDetailsList = new List<String>();
for(String s : mfields.keySet()){
sObjectDetailsList.add(String.valueOf(mfields.get(s)));
}
system.debug('sObjectDetailsList------'+sObjectDetailsList);
return sObjectDetailsList;
} */


@AuraEnabled(cacheable=true)
public static list<CaseWrapper> getCaseFields() {
list<string> fvlst = new list<string>();
list<CaseWrapper> lstwrp = new list<CaseWrapper>();
list<string> fieldvaluelst = new list<string>();
String obj = 'Case';
Map<String,Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.SObjectType sobjType = gd.get(obj);
Schema.DescribeSObjectResult describeResult = sobjType.getDescribe();
Map<String,Schema.SObjectField> fieldsMap = describeResult.fields.getMap();
system.debug('fieldsMap---'+fieldsMap);
CaseWrapper cwrp = new CaseWrapper();
cwrp.AccountId = fieldsMap.get('AccountId').getDescribe().getLabel();
cwrp.CaseNumber = fieldsMap.get('CaseNumber').getDescribe().getLabel();
cwrp.AssetId = fieldsMap.get('AssetId').getDescribe().getLabel();
cwrp.Origin = fieldsMap.get('Origin').getDescribe().getLabel();
cwrp.OwnerId = fieldsMap.get('OwnerId').getDescribe().getLabel();
cwrp.Reason = fieldsMap.get('Reason').getDescribe().getLabel();
cwrp.SourceId = fieldsMap.get('SourceId').getDescribe().getLabel();
  cwrp.IsClosedOnCreate = fieldsMap.get('IsClosedOnCreate').getDescribe().getLabel();
cwrp.SuppliedName = fieldsMap.get('SuppliedName').getDescribe().getLabel();
cwrp.ContactEmail = fieldsMap.get('ContactEmail').getDescribe().getLabel();
cwrp.Status = fieldsMap.get('Status').getDescribe().getLabel();
cwrp.Type = fieldsMap.get('Type').getDescribe().getLabel();
cwrp.SuppliedPhone = fieldsMap.get('SuppliedPhone').getDescribe().getLabel();
cwrp.SuppliedEmail = fieldsMap.get('SuppliedEmail').getDescribe().getLabel();
cwrp.SuppliedCompany = fieldsMap.get('SuppliedCompany').getDescribe().getLabel();
cwrp.Subject = fieldsMap.get('Subject').getDescribe().getLabel();
cwrp.Priority = fieldsMap.get('Priority').getDescribe().getLabel();
cwrp.ContactFax = fieldsMap.get('ContactFax').getDescribe().getLabel();
cwrp.ContactMobile = fieldsMap.get('ContactMobile').getDescribe().getLabel();
cwrp.ContactId = fieldsMap.get('ContactId').getDescribe().getLabel();
cwrp.ContactPhone = fieldsMap.get('ContactPhone').getDescribe().getLabel();
cwrp.Description = fieldsMap.get('Description').getDescribe().getLabel();
cwrp.Comments = fieldsMap.get('Comments').getDescribe().getLabel();
cwrp.LastModifiedById = fieldsMap.get('LastModifiedById').getDescribe().getLabel();
cwrp.ParentId = fieldsMap.get('ParentId').getDescribe().getLabel();
cwrp.CreatedDate = fieldsMap.get('CreatedDate').getDescribe().getLabel();
cwrp.PotentialLiability = fieldsMap.get('PotentialLiability__c').getDescribe().getLabel();
cwrp.EngineeringReqNumber = fieldsMap.get('EngineeringReqNumber__c').getDescribe().getLabel();
cwrp.Product = fieldsMap.get('Product__c').getDescribe().getLabel();
cwrp.SLAViolation = fieldsMap.get('SLAViolation__c').getDescribe().getLabel();
lstwrp.add(cwrp);
system.debug('wrplist--'+lstwrp);
return lstwrp;
}

@AuraEnabled
public static void saveRecords(Case Obj) {
system.debug('obj'+ obj);
Insert Obj;
}
public with sharing class FetchValueWrapper {
@AuraEnabled public string slabel {get;set;}
@AuraEnabled public string svalue {get;set;}
}
}
Hello,

I created a scratch orgs without problems and now I am trying to push the source from the local branch.
I am getting 68 errors of this type:
An object 'Account.ParentId' of type CustomField was named in package.xml, but was not found in zipped directory
All the mentioned fields are in the sfdx project source under main/default/objects/Account/fields and the scratch org API version matches the project one. 
Could anyone help me understand what I'm doing wrong, please?

Many thanks!
Sabina
 
I've connected various queries to Excel using Microsoft Excel Power Query. Unfortunately, I have to log in each time again at Salesforce via a dialog window. Is there a VBA script with which I can automate this login?