• Lorenzo Perego
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Hello everyone,

i think i found a bug but I hope to be wrong because I absolutely need this feature.

I have a lightnng:select and i'm  setting up the selected value dinamically.


I enclose the images of android vs ios.

IOS Before callback

IOS before callback
IOS After Callback
IOS after callback

Android before callback
Android before callback

Android after callback
Android after callback

My code:
<lightning:select disabled="{!!v.accountId}" label="Modalitá spedizione">
    <aura:iteration items="{!v.spedizione}" var="sped">
        <option value="{!sped.value}" text="{!sped.label}" 
            selected="{!sped.value==v.accountDetail.Modalit_spedizione__c}">
        </option>
    </aura:iteration>
</lightning:select>
 i change v.accountDetail.Modalit_spedizione__c dinamically like this after a Callback in my controller:
var response = response.getReturnValue();
component.set("v.accountDetail", response);
 in Android it works fine, on iphone doesn't work. 
The strange thing is that disabled="{!!v.accountId}" works ( i run this component.set("v.accountId", THEID); in an external event of my component) but the selected="{!sped.value==v.accountDetail.Modalit_spedizione__c}"> doesn't

Thanks to all!

 
How can i make a mass Delete of orders?

The error is that i can't delete an active order, that's ok.

So the question is how can i deactivate multiple orders?
I tryed to change status like Status='a deactivated category status' but it doesn't work.

Thanks all

 
Hello to everyone, I have this problem that I have to solve as soon as possible.

I have an Account trigger after insert that calls an external http request.

It works all in sandbox, the call comes to the web server and does what it needs to do.

When I'm going to deploy it into production, the test (very basic) returns error:
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

Here is my trigger after insert
 
trigger Account_Trigger on Account (after insert,after update) {
	if (Trigger.isInsert){
		for(Account a : Trigger.new ){
			String acc_json = JSON.serialize(a);
	    	Future.insert_cliente(acc_json);             
    	        }                       
	}
	else if (Trigger.IsUpdate) {
		for(Account a : Trigger.new ){
			String acc_json = JSON.serialize(a);
	    	Future.update_cliente(acc_json);             
    	        }  
	}
}
Here is my Future Class
 
public class Future {
    
    public static void update_cliente(String obj) {
    	String end_point = 'http://xxxxxxxxxx/saleforce/update_cliente/';
    	Put(obj, end_point);
    }
    
    public static void insert_cliente(String obj) {
    	String end_point = 'http://xxxxxxxxxx/saleforce/insert_cliente/';
    	Put(obj, end_point);
    }
    
    @future(callout=true)
    public static void Put(String obj, String end_point)
    { 
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        request.setEndpoint(end_point);
        request.setMethod('PUT');
        Blob headerValue = Blob.valueOf('xxxxx'+ ':' + 'xxxxx');
        String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
        request.setHeader('Authorization', authorizationHeader);
        request.setBody(obj);
        HttpResponse response = http.send(request);
        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) {
                System.debug(response.getStatusCode());
        }
        else{
            System.debug(response.getStatusCode());    
        }  
    }
}

Here is my FutureMock to use in Test:
 
@isTest
global class FutureMock implements HttpCalloutMock
{
    global HttpResponse respond(HttpRequest request)
    {
        HttpResponse res = new HttpResponse();
        res.setBody( '{"my":"value"}');
        res.setStatusCode(200);
        return res;
    }
}

Here is my Test for Account that returns me error:
 
@isTest
private class Account_TriggerTest
{
	 public static testMethod void testWithExistingDec()
	{
		Test.setMock(HttpCalloutMock.class, new FutureMock());
		profile p= [select id from profile limit 1];
		User u=new user(username='aa@test.it', lastname='aaa', Email='aa@test.it', 
                                           TimeZoneSidKey='Europe/Rome', LocaleSidKey='it_IT', 
		                           EmailEncodingKey='ISO-8859-1', 
                                           LanguageLocaleKey='it',CommunityNickname='test',Alias='aaa', 
                                           Profileid=p.id)  ; 
		insert u;
		Account acc=new Account (name='ABCD', Ownerid=u.id);
		insert acc;
		System.assertEquals(acc.Ownerid,u.id); 
		
	}
}

Can someone help me?
What am I doing wrong?

 
How can i make a mass Delete of orders?

The error is that i can't delete an active order, that's ok.

So the question is how can i deactivate multiple orders?
I tryed to change status like Status='a deactivated category status' but it doesn't work.

Thanks all