Calling actions directly and not with generated drop down

I am trying to call the view logs function from a different location in my angular code. I can only seem to find the php implemenation of how it opens a dialog

$audit_link = “<a href=‘javascript:void(0)’ onclick='open_popup("Audit", "600", "400", "&record=”.$_REQUEST[‘record’].“&module_name=”.$_REQUEST[‘module’].“", true, false, $encoded_popup_request_data);'>”.$this->local_app_strings[‘LNK_VIEW_CHANGE_LOG’].“”;

but I cant see if there is a service function that can be called directly.

@rossrawlins ,
I havent done this precisely but there are two ways to do this in Angular that I am aware of:

  1. Call a process that returns the list, this would call a PHP process to get the list you are after, returns it and you process it in Angular.

  2. Take a look at the sidebar widget docs: Adding a Custom Sidebar Widget :: SuiteCRM Documentation this gives examples of loading lists of records using the Angular API (I found this too complex to understand without it being broken down more so went with 1)

So a brief overview of 1)

in your component import process, processservice and in the constructor have this: private processService: ProcessService

then a function something like this:

private searchCategories(): Observable<Process> {

        var options = {
            dataElements: {
                filter: this.filter
            }
        };

        return this.processService
            .submit('search-valid-service-categories', options)
            .pipe(

                catchError(err => {

                    throw err;
                }),
            );

    }

The key above: search-valid-service-categories, is the key in the php process :


class SearchValidServiceCategoriesHandler extends LegacyHandler implements ProcessHandlerInterface, LoggerAwareInterface
{
    protected const MSG_OPTIONS_NOT_FOUND = 'Process options is not defined';
    protected const PROCESS_TYPE = 'search-valid-service-categories';

which would be used like this:


this.searchCategories().subscribe((records) => {
                if (records.data.value != undefined) {
                    this.categorylist = [];
                    for (let catcounter = 0; catcounter < records.data.value.length; catcounter++) {
                        let tmp = {};

                        tmp["value"] = records.data.value[catcounter].ID;
                        tmp["name"] = records.data.value[catcounter].name;
                        this.categorylist.push(tmp);
                    }
                }
            });

and in the html something like this:

<select name="service-category" [ngModel]="servicecategory" (ngModelChange)="updateServiceCategory($event)" class="form-control">
    						<option *ngFor="let category of categorylist" [attr.selected]="(servicecategory == category.value)" [value]="category.value">
        								{{ category.name }}
    						</option>
						</select>	

(there are extras in there, obviously the PHP can do what you like so you should be able to send over the options and select the Audit lines you are after.

Mark