• pk1772
  • NEWBIE
  • 60 Points
  • Member since 2017
  • Senior Developer


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

Have some code in VS Code, received from a scratch org with enabled Community(Digital Experiences). Want this to push to a new scratch org. "Push Source to Default Scratch Org" always fails with exit code 1
SfdxError: 
<html> <body>
<table cellspacing=10><tr><td><span style="font-weight: bold; font-size: 12pt;">Illegal Request</span></td></tr>
    <tr<td>You have sent us an Illegal URL or an improperly formatted request.</td></tr>
    <tr><td></td></tr></table>
<!-- Body events -->
<script type="text/javascript">function bodyOnLoad(){if(window.PreferenceBits){window.PreferenceBits.prototype.csrfToken="null";};}function bodyOnBeforeUnload(){}function bodyOnFocus(){}function bodyOnUnload(){}</script></body></html>

Tried a lot, but still have no clue: minimal project-scratch-dev.json, CLI latest version (7.92) and also an older; Has someone an idea where to look for error reason? Any help would be greatly appreciated.

  • March 24, 2021
  • Like
  • 0
Is there any way that I can open the default browser from my branded mobile publisher app and to a specific url? There seems to be limitaion on file download in mobile apps and as a workaround I am trying to open the default browser(eg. chrome for android, safari for ios) on the mobile device to download the file. I am looking for something similar like Inappbrowser plugin (http://cordova.apache.org/docs/en/9.x/reference/cordova-plugin-inappbrowser/index.html) in Cordova that can be handled from JS code - 
cordova.InAppBrowser.open('http://apache.org', '_system', 'location=yes');

Of if something can be achieved through configuration, that would be great! 
  • March 26, 2021
  • Like
  • 0
I am calling a webservice (synchronous) and in case of CalloutException, I'm trying to create an error log in a custom object. The problem is, the record insertion is happening in a future method and after an exception has encountered, the method is not getting called. In case, I remove the @future annotation, the record does not get committed to the database. Has anyone faced similar issue and is there any workaround?
  • January 10, 2019
  • Like
  • 0
Hi, I tried to build an Event component. I am not experienced in SF and have an error, that I cant solve. Could you try out the code and tell me how to solve this error:User-added image

<aura:component controller="EventController" implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId" >
    <aura:attribute name="recordId" type="Id" />
    <aura:attribute name="newEvent" type="Event" default="{'sobjectType':'Event'}"/>
    <aura:attribute name="event" type="Event[]"/>
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:attribute name="mycolumns" type="List"/>
    <lightning:card iconName="standard:event" title="Event">
        <div class="slds-card__body slds-card__body_inner"> 
        </div>
        <div>
            <aura:if isTrue="{!not(empty(v.events))}">
                <lightning:datatable data="{!v.events }" 
                         columns="{!v.mycolumns }" 
                         keyField="Id"
                         hideCheckboxColumn="true"/>
                <aura:set attribute="else">
                    <div Style="text-align : center"> " There are no Events currently "</div>
                </aura:set>
            </aura:if>
        </div>
    </lightning:card>
</aura:component>


Controller:
({
    doInit: function(component, event, helper) {
        
        component.set('v.mycolumns', [
            {label: 'Id', fieldName: 'Id', type: 'url', 
            typeAttributes: {label: { fieldName: 'Id' }, target: '_blank'}},
            
            {label: 'Subject', fieldName: 'Id', type: 'url',
            typeAttributes: {label: { fieldName: 'Subject' }, target: '_blank'}},
            {label: 'Activity Date', fieldName: 'ActivityDate', type: 'text'},
            
        ]);
        var action = component.get("c.loadEvents");
        var whatId = component.get("v.recordId");
        action.setParams({
            "recordId":whatId
        });
            
            action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                var records =response.getReturnValue();
                records.forEach(function(record){       
                    record.Subject= record.Subject;
                    record.ActivityDate= record.ActivityDate;
                });
                component.set("v.event", records);
            }
        });
        $A.enqueueAction(action);
    },
    createNewTask : function(component, event, helper) {
        var action = component.get("c.saveEvent");
        var newEvent = component.get("v.newEvent");
        action.setParams({
            "event": newEvent
        });
        action.setCallback(this,function(response){
            var state = response.getState();
                        
            if(component.isValid() && state === "SUCCESS"){
                
                var items = component.get("v.events");
                items.push(response.getReturnValue());
                component.set("v.events",items);
            }
            else{
                console.log("Failed with state "+state);
            }
        });
        $A.enqueueAction(action);
    }
})

Apex:
public with sharing class EventController {
  @AuraEnabled
  public static List<Event> loadEvents(Id recordId){
    return[SELECT Subject, ActivityDate FROM Event WHERE WhatId=:recordId And ActivityDate>= TODAY AND ActivityDate  <= Next_N_Days:3];
  }
  @AuraEnabled
  public static Event saveEvent(Event event){
    upsert event;
    return event;
   }
}
I am tring to create parent (emp)object and child(training) object..PArent has D-M with another object (site). DEficiency is a staging object.
global class BatchStaging implements Database.Batchable<sObject> {
  
  global Database.QueryLocator start(Database.BatchableContext BC) {
    String query = 'SELECT id,Employee_Code__c,Account_Provisioning__c,Arbitration_Agreement__c,Basic_Info__c,BGC__c,Business_Coach__c,Classroom_Training__c,Compliance_Specialist__c,Current_Stage__c,Delivery_Attributes__c,Driver_License_Verification__c,Driver_Message__c,Driver_Record_Verification__c,Drug_Alcohol_test__c,DSP__c,First_Name__c,Form_Type__c,Invitation_Accepted__c,Last_Name__c,Location_Code__c,Location_Level_4__c,Message_Description__c,Middle_Initial__c,Photo_Upload__c,Provider_Info__c,Station__c,Status__c FROM Deficiency__c';
        
    return Database.getQueryLocator(query);
  }
  
  global void execute(Database.BatchableContext BC, List<Deficiency__c> scope)
    {
                     
                Map<string,Deficiency__c> newAccRecMap = new Map<string,Deficiency__c>();
            for(Deficiency__c stg : scope)
                  {
                      
                newAccRecMap.put(stg.Employee_Code__c,stg);
                newAccRecMap.put(stg.First_Name__c,stg);
                newAccRecMap.put(stg.Middle_Initial__c,stg);
                newAccRecMap.put(stg.Last_Name__c,stg);
                      
                //newAccRecMap.put(stg.First_Name__c + ''+stg.Middle_Initial__c +''+stg.Last_Name__c,stg); 
                      System.debug(newAccRecMap);
                }
                   
                List<Deficiency__c> List2=[select ID,Employee_Code__c,First_Name__c,Middle_Initial__c,Last_Name__c from Deficiency__c where Employee_Code__c IN: newAccRecMap.keySet() Limit 50000];
               System.debug(List2);
                if(List2.size() > 0)
                       {
                            for(Deficiency__c stg1 : List2)
                            {
                                if(newAccRecMap.containsKey(stg1.Employee_Code__c)&& newAccRecMap.containsKey(stg1.First_Name__c)&&newAccRecMap.containsKey(stg1.Middle_Initial__c)&& newAccRecMap.containsKey(stg1.Last_Name__c))
                                    
                                {
                                    System.debug(stg1);
                                    System.debug('duplicate');
                                }
                                                          
      
                            }
                       }
                        List<Employee__c> emp=new List<Employee__c>();
                            for(Deficiency__c stg2: scope)
                            {
                                System.debug(scope);
                                Employee__c emp1=new Employee__c();
                                
                                emp1.Employee_Code__c = stg2.Employee_Code__c;
                                //emp1.Id=stg2.id;
                                emp1.Location__c =stg2.Location_Code__c;
                                //emp1.Email__c='abc@gmail.com';
                               // emp1.Phone__c= 0000;
                                emp.add(emp1);
                                Sytem.debug('created parent');
                                System.debug(emp1.Location__c);
                                System.debug(stg2.Location_Level_4__c);
                            }
                            insert emp;
                            List<Training_Detail__c> Childs = new List<Training_Detail__c>();
                     
                                for(Deficiency__c stg3 : scope)
                                {
                                    System.debug(stg3);
                                   Training_Detail__c Child = new Training_Detail__c ();
                                   Child.Employee__c = stg3.Employee_Code__c;
                                  // Child.Name = stg3.Training_Name__c; 
                                   Childs.add(Child);  
                                    System.debug('created child');
                                }
                            
                                insert Childs;
    }

  global void finish(Database.BatchableContext BC)
    {
        System.debug('>>>Finish');
  }
  }

Have some code in VS Code, received from a scratch org with enabled Community(Digital Experiences). Want this to push to a new scratch org. "Push Source to Default Scratch Org" always fails with exit code 1
SfdxError: 
<html> <body>
<table cellspacing=10><tr><td><span style="font-weight: bold; font-size: 12pt;">Illegal Request</span></td></tr>
    <tr<td>You have sent us an Illegal URL or an improperly formatted request.</td></tr>
    <tr><td></td></tr></table>
<!-- Body events -->
<script type="text/javascript">function bodyOnLoad(){if(window.PreferenceBits){window.PreferenceBits.prototype.csrfToken="null";};}function bodyOnBeforeUnload(){}function bodyOnFocus(){}function bodyOnUnload(){}</script></body></html>

Tried a lot, but still have no clue: minimal project-scratch-dev.json, CLI latest version (7.92) and also an older; Has someone an idea where to look for error reason? Any help would be greatly appreciated.

  • March 24, 2021
  • Like
  • 0