• Thabthimsaen Wuttisak
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi Everyone,
I am a newbie for creating an apex class. I create an Apex class to update a status. Then, I tried to create a test class. However, I received the below error message.

"Method does not exist or incorrect signature: void Updatestatus(ConsumableSample__c) from the type UpdateStatusController"

Could you please advise?

My Apex Class:

global without sharing class UpdateStatusController {
    @AuraEnabled
    global static Boolean Updatestatus(Id sampleid){
        try{
        
            ConsumableSample__c cs= [Select Id,Name,Process_Status__c from ConsumableSample__c where Id=:sampleid];
            cs.Process_Status__c = 'Cancel';
            update cs; 
            return true;
        }
        catch(Exception e){
            return false;
        }
    }
}


My Apex Test Class:

@isTest
public class UpdateStatusControllerTest {
  static testMethod void test1() {
      Date sDate = Date.newInstance(Date.today().Year(), 1, 1);
        Date eDate = Date.newInstance(Date.today().Year() + 1, 12, 31);
        Integer cnt = sDate.daysBetween(eDate);
        List<OlympusCalendar__c> ocList = new List<OlympusCalendar__c>();
        String cc = 'Singapore';
        for (Integer i=0; i<cnt; i++) {
            ocList.add(new OlympusCalendar__c(Date__c=sDate.addDays(i),Country__c = cc));
        }
        insert ocList;
        
        Date nowWD = Date.today();
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and Name='Hospital'].id;
        hospital.Name = '华佗扁鹊孙思邈';
        hospital.Adress__c = '医界仙葩,圣手仁心!';
        insert hospital;
        
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.Name = 'GI-Dept'];        
        
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and Name = 'Gastoro Intestin'].id;
        dep.Name = '救济丸';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;

        ConsumableSample__c request = new ConsumableSample__c(Hospital__c = hospital.Id,
        Expect_Arrive_Date__c = Date.today(),Expect_Use_Date__c = Date.today(),
        PIC__c = Userinfo.getUserId());
        insert new list<ConsumableSample__c> { request };

        test.startTest();
        UpdateStatusController.Updatestatus(request);
        test.stopTest();
  }
}
 
Hi everyone,

I want to show only account that I selected in Wave Dashboard. My dataset in Wave Dashboard is...

"Hospital_fullName__c_19": {
                "datasets": [
                    {
                        "id": "0Fb10000000fxbNCAQ",
                        "label": "SAP_Sales_Result_Single",
                        "name": "SAP_Sales_Result_Single",
                        "url": "/services/data/v39.0/wave/datasets/0Fb10000000fxbNCAQ"
                    }
                ],
                "isFacet": true,
                "isGlobal": false,
                "query": {
                    "measures": [
                        [
                            "sum",
                            "Quantity_wave__c"
                        ]
                    ],
                    "groups": [
                        "Hospital_fullName__c"
                    ],
                    "filters": [
                        [
                            "-Closed Date",
                            [
                                [
                                    [
                                        "fiscal_year",
                                        -1
                                    ],
                                    [
                                        "fiscal_year",
                                        1
                                    ]
                                ]
                            ]
                        ],
                        [
                            "Recordtype_Name__c",
                            [
                                "2.Result"
                            ],
                            "in"
                        ],
                        [
                            "Tier1_BSS_Category__c",
                            [
                                "ET"
                            ],
                            "in"
                        ]
                    ]
                },
                "selectMode": "multi",
                "start": [],
                "type": "aggregate",
                "useGlobal": true,
                "visualizationParameters": {
                    "visualizationType": "hbar",
                    "options": {}
                }


Then I created field mapping like this.


    {
        "datasets": {
            "SAP_Sales_Result_Single": [
                {
                "fields": ["Hospital_fullName__c_19"],
                    "filter": {
                        "Hospital_fullName__c": ["$Hospital_Name__c"]
                              }
                }
                ]
                }
         }

But it does not work.

Do you have any suggestion for me?

Thanks,
Bass
Hi,

I am trying to use the following but it got this error (Wave Dashboard Analytics)

                        [
                            "BC_Wave__c",
                            "{{selection(BC_Wave__c_12)}}"
                        ],

Do you have any idea how to fix it?

Thanks,
Bass
Hi Everyone,
I am a newbie for creating an apex class. I create an Apex class to update a status. Then, I tried to create a test class. However, I received the below error message.

"Method does not exist or incorrect signature: void Updatestatus(ConsumableSample__c) from the type UpdateStatusController"

Could you please advise?

My Apex Class:

global without sharing class UpdateStatusController {
    @AuraEnabled
    global static Boolean Updatestatus(Id sampleid){
        try{
        
            ConsumableSample__c cs= [Select Id,Name,Process_Status__c from ConsumableSample__c where Id=:sampleid];
            cs.Process_Status__c = 'Cancel';
            update cs; 
            return true;
        }
        catch(Exception e){
            return false;
        }
    }
}


My Apex Test Class:

@isTest
public class UpdateStatusControllerTest {
  static testMethod void test1() {
      Date sDate = Date.newInstance(Date.today().Year(), 1, 1);
        Date eDate = Date.newInstance(Date.today().Year() + 1, 12, 31);
        Integer cnt = sDate.daysBetween(eDate);
        List<OlympusCalendar__c> ocList = new List<OlympusCalendar__c>();
        String cc = 'Singapore';
        for (Integer i=0; i<cnt; i++) {
            ocList.add(new OlympusCalendar__c(Date__c=sDate.addDays(i),Country__c = cc));
        }
        insert ocList;
        
        Date nowWD = Date.today();
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and Name='Hospital'].id;
        hospital.Name = '华佗扁鹊孙思邈';
        hospital.Adress__c = '医界仙葩,圣手仁心!';
        insert hospital;
        
        List<Account> strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.Name = 'GI-Dept'];        
        
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and Name = 'Gastoro Intestin'].id;
        dep.Name = '救济丸';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;

        ConsumableSample__c request = new ConsumableSample__c(Hospital__c = hospital.Id,
        Expect_Arrive_Date__c = Date.today(),Expect_Use_Date__c = Date.today(),
        PIC__c = Userinfo.getUserId());
        insert new list<ConsumableSample__c> { request };

        test.startTest();
        UpdateStatusController.Updatestatus(request);
        test.stopTest();
  }
}
 
Hi,

I am trying to use the following but it got this error (Wave Dashboard Analytics)

                        [
                            "BC_Wave__c",
                            "{{selection(BC_Wave__c_12)}}"
                        ],

Do you have any idea how to fix it?

Thanks,
Bass